Return-Path: X-Original-To: apmail-lucene-solr-user-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8761D17E18 for ; Sat, 13 Jun 2015 19:38:12 +0000 (UTC) Received: (qmail 68831 invoked by uid 500); 13 Jun 2015 19:38:07 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 68754 invoked by uid 500); 13 Jun 2015 19:38:07 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 68742 invoked by uid 99); 13 Jun 2015 19:38:07 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Jun 2015 19:38:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 89A4A1A55B0 for ; Sat, 13 Jun 2015 19:38:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 5.214 X-Spam-Level: ***** X-Spam-Status: No, score=5.214 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, KAM_LIVE=1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URI_HEX=1.313, WEIRD_PORT=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id rnAOWAsNz-UK for ; Sat, 13 Jun 2015 19:37:55 +0000 (UTC) Received: from mail-yk0-f180.google.com (mail-yk0-f180.google.com [209.85.160.180]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id CAF1942AF1 for ; Sat, 13 Jun 2015 19:37:54 +0000 (UTC) Received: by ykar6 with SMTP id r6so6126329yka.2 for ; Sat, 13 Jun 2015 12:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Dvw86D+bDkUb0radYsfKCdteYNcMQgrVJ2gptMfucPY=; b=bKA2uTGFitAJWC2mKRSN5+GxefI3wxNOZF4GJYo0uUmYmIqYqPy1j6rTXLmezbaAkb vAfkatbSMP26/0zcVgVt13v+mOo9ebsGwbhHqnto7rvtb5d8Rk8g5+f41GMK9j/dqnaI 3VAYSxal4+Vr+/yIL1wI/DTI7XjmFthGRy0KZiroi8rO91m0NxYr9A6uiqI0eAS6qMLE e6HM26X5Ea26tfnH4KeZNdWb1WAqXc5D7PHnK3qvagMgL39KCTsKREX3SuXhHgxl0hgq X/SHFfl3KwbEJbdIT+O3C+nOh1SwsDnYMx6Hebj121b2N/OUJ1TzsjSJkmOBAScAnkKa CXYQ== MIME-Version: 1.0 X-Received: by 10.13.253.5 with SMTP id n5mr9131967ywf.24.1434224268001; Sat, 13 Jun 2015 12:37:48 -0700 (PDT) Received: by 10.129.102.11 with HTTP; Sat, 13 Jun 2015 12:37:47 -0700 (PDT) In-Reply-To: References: <1434119432169-4211402.post@n3.nabble.com> Date: Sat, 13 Jun 2015 13:37:47 -0600 Message-ID: Subject: Re: Division with Stats Component when Grouping in Solr From: William Bell To: "solr-user@lucene.apache.org" Content-Type: multipart/alternative; boundary=94eb2c06b83a05c59105186b5c7f --94eb2c06b83a05c59105186b5c7f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable OK. That works with one more change. http://localhost:8983/solr/select?q=3D*%3A*&wt=3Djson&indent=3Dtrue&stats= =3Dtrue&olap=3Dtrue&olap.overall_score.statistic.sum=3Dsum(overall_score) On Sat, Jun 13, 2015 at 1:16 PM, William Bell wrote: > OK more info > > > > query > facet > analytics > highlight > debug > expand > > > > > > > I am going to try that after adding it to solrconfig.xml. > > > > On Sat, Jun 13, 2015 at 1:11 PM, William Bell wrote= : > >> Same here. >> >> What do we need to add to solrconfig.xml to get it to work? >> >> >> 1. SOLR-5302 >> 2. >> 3. Help/ >> >> >> On Sat, Jun 13, 2015 at 8:34 AM, kingofhypocrites < >> kingofhypocrites@gmail.com> wrote: >> >>> This looks very promising if only I could get it to work: >>> https://issues.apache.org/jira/browse/SOLR-5302 >>> >>> https://issues.apache.org/jira/secure/attachment/12606793/Search%20Anal= ytics%20Component.pdf >>> >>> Various links it points to are broken now and i can't find anything abo= ut >>> it online, but the PDF indicates I can set olap=3Dtrue to turn it on, >>> although this doesn't seem to do anything. The docs say it supports >>> limiting the results and doing math operations on statistics which is >>> exactly what I need. I'm not clear if I need to install this or if this >>> component is even used anymore. >>> >>> On Fri, Jun 12, 2015 at 12:00 PM Joel Bernstein [via Lucene] < >>> ml-node+s472066n4211422h61@n3.nabble.com> wrote: >>> >>> > https://issues.apache.org/jira/browse/SOLR-7560, will almost support >>> this >>> > in Solr 5.3. The compound function support won't be there yet though. >>> But >>> > it will be there in the near future. >>> > >>> > >>> > >>> > Joel Bernstein >>> > http://joelsolr.blogspot.com/ >>> > >>> > On Fri, Jun 12, 2015 at 9:30 AM, kingofhypocrites < >>> > [hidden email] >> /user/SendEmail.jtp?type=3Dnode&node=3D4211422&i=3D0>> >>> > wrote: >>> > >>> > > I am migrating a database from SQL Server to Cassandra. Currently I >>> have >>> > a >>> > > setup as follows: >>> > > >>> > > - Log data in Cassandra >>> > > - Summarize data in Spark and put into Cassandra summary tables >>> > > - Query data in Solr >>> > > >>> > > Everything fits beautifully until I need to do stats on groups. I a= m >>> > hoping >>> > > to get this to work with Solr so I can stick to one database, but I >>> am >>> > not >>> > > sure it's possible. >>> > > >>> > > If I had it in SQL Server, I could do it like so: >>> > > SELECT >>> > > site_id, >>> > > keyword, >>> > > SUM(visits) as visits, >>> > > CONVERT(DECIMAL(13, 3), SUM(bounces)) / SUM(visits) as >>> bounce_rate, >>> > > SUM(pageviews) as pageviews, >>> > > CONVERT(DECIMAL(13, 3), SUM(pageviews)) / SUM(visits) as >>> > > avg_pages_per_visit >>> > > FROM >>> > > report_all_keywords_daily >>> > > WHERE >>> > > site_id =3D 55 AND date_key >=3D '20150606' AND date_key <=3D >>> '20150608' >>> > > GROUP BY >>> > > site_id, keyword >>> > > ORDER BY visits DESC >>> > > >>> > > Now I need to replicate this in Solr. The closest I could get to >>> this is >>> > by >>> > > using the Stats component and then using field collapsing. >>> > > >>> > > >>> > >>> group=3Dtrue&group.field=3Dkeyword&stats=3Dtrue&stats.field=3Dvisits&st= ats.facet=3Dkeyword >>> > >>> > > >>> > > And here are some results I get back: >>> > > http://pastebin.com/raw.php?i=3DFxhe2RA0 >>> > > >>> > > However, I need to do able to divide certain metrics. I tried >>> including >>> > > functions in the stats.field such as div(sum(bounce_rate), >>> (sum(visits)) >>> > > but >>> > > it doesn't recognize the functions. Also it seems to ignoring the >>> paging >>> > > for >>> > > the stats results and returns all groups regardless. >>> > > >>> > > Ultimately I'd like something like this which is what I would get i= n >>> > SQL: >>> > > >>> > > >>> > > Is this possible or do I have to give up on the prospect of using >>> Solr? >>> > I >>> > > have to query this data dynamically so I can't pre-summarize all of >>> it. >>> > > >>> > > To clarify I having the following two problems: >>> > > - Paging is ignored for stats data >>> > > - I can't figure out how to divide two stats together to get a thir= d >>> > stat. >>> > > Note: In some cases I would need to be able to sort on this combine= d >>> > stat >>> > > >>> > > >>> > > >>> > > -- >>> > > View this message in context: >>> > > >>> > >>> http://lucene.472066.n3.nabble.com/Division-with-Stats-Component-when-G= rouping-in-Solr-tp4211402.html >>> > > Sent from the Solr - User mailing list archive at Nabble.com. >>> > > >>> > >>> > >>> > ------------------------------ >>> > If you reply to this email, your message will be added to the >>> discussion >>> > below: >>> > >>> > >>> http://lucene.472066.n3.nabble.com/Division-with-Stats-Component-when-G= rouping-in-Solr-tp4211402p4211422.html >>> > To unsubscribe from Division with Stats Component when Grouping in >>> Solr, click >>> > here >>> > < >>> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=3Duns= ubscribe_by_code&node=3D4211402&code=3Da2luZ29maHlwb2NyaXRlc0BnbWFpbC5jb218= NDIxMTQwMnwtNDY4MDgyMzk1 >>> > >>> > . >>> > NAML >>> > < >>> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=3Dmac= ro_viewer&id=3Dinstant_html%21nabble%3Aemail.naml&base=3Dnabble.naml.namesp= aces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.we= b.template.NodeNamespace&breadcrumbs=3Dnotify_subscribers%21nabble%3Aemail.= naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aema= il.naml >>> > >>> > >>> >>> >>> >>> >>> -- >>> View this message in context: >>> http://lucene.472066.n3.nabble.com/Division-with-Stats-Component-when-G= rouping-in-Solr-tp4211402p4211525.html >>> Sent from the Solr - User mailing list archive at Nabble.com. >>> >> >> >> >> -- >> Bill Bell >> billnbell@gmail.com >> cell 720-256-8076 >> > > > > -- > Bill Bell > billnbell@gmail.com > cell 720-256-8076 > --=20 Bill Bell billnbell@gmail.com cell 720-256-8076 --94eb2c06b83a05c59105186b5c7f--