Return-Path: Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: (qmail 40018 invoked from network); 4 Apr 2011 08:19:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Apr 2011 08:19:37 -0000 Received: (qmail 30944 invoked by uid 500); 4 Apr 2011 08:19:34 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 30677 invoked by uid 500); 4 Apr 2011 08:19:33 -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 30668 invoked by uid 99); 4 Apr 2011 08:19:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2011 08:19:32 +0000 X-ASF-Spam-Status: No, hits=4.0 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of kaychaks@gmail.com designates 209.85.212.180 as permitted sender) Received: from [209.85.212.180] (HELO mail-px0-f180.google.com) (209.85.212.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2011 08:19:23 +0000 Received: by pxj25 with SMTP id 25so472316pxj.11 for ; Mon, 04 Apr 2011 01:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=jmUGT0NtKTnz0ynT3IB7A3neqsx9t4sRd5Yb/LSGTPI=; b=q3TBCxxPeh2IkLxkyQckIWQ+CGGIjXvqRW9XWjtIdhk0GVkqKXA5/dsPWXZvXGe1yQ 2goJxaL8dhAraL0pfJPfapP+GG6rMSkk838k0sCjt8alR3KIFA5WYDLxm8Es4pgUlm50 t2fc3Kiwb5NNenwupwt5z9ulaNn3vaZtlGclw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=CcVMlhYJPqZfjDLXAZHkDmD6b6CPdkN2ymHH5O2fYb0T1Pt2YxzVv1UiTF4etFSDVs x3wsrfwc3xAqhNlyQL453IAMBg/xWtGxM0wv2hraPMXE+buVPBKkKTCMaVVOOLt0PSGj Cizilam3D8ICecnZZ/4EzLjeRaqjwI0KTTs3A= Received: by 10.142.149.20 with SMTP id w20mr6494482wfd.137.1301905142184; Mon, 04 Apr 2011 01:19:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.43.35 with HTTP; Mon, 4 Apr 2011 01:18:42 -0700 (PDT) In-Reply-To: References: From: Kaushik Chakraborty Date: Mon, 4 Apr 2011 13:48:42 +0530 Message-ID: Subject: Re: Faceting on multivalued field To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=000e0cd22fe887fb1904a0136926 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd22fe887fb1904a0136926 Content-Type: text/plain; charset=ISO-8859-1 Are you implying to change the DB query of the nested entity which fetches the comments (query is in my post) or something can be done during the index like using Transformers etc. ? Thanks, Kaushik On Mon, Apr 4, 2011 at 8:07 AM, Erick Erickson wrote: > Why not count them on the way in and just store that number along > with the original e-mail? > > Best > Erick > > On Sun, Apr 3, 2011 at 10:10 PM, Kaushik Chakraborty >wrote: > > > Ok. My expectation was since "comment_post_id" is a MultiValued field > hence > > it would appear multiple times (i.e. for each comment). And hence when I > > would facet with that field it would also give me the count of those many > > documents where comment_post_id appears. > > > > My requirement is getting total for every document i.e. finding number of > > comments per post in the whole corpus. To explain it more clearly, I'm > > getting a result xml something like this > > > > 46 > > Hello World > > 20 > > > > 9 > > 10 > > > > > > 19 > > 2 > > > > > > 46 > > 46 > > > > > > Hello - from World > > Hi > > > > > > > > > > *1* > > > > I need the count to be 2 as the post 46 has 2 comments. > > > > What other way can I approach? > > > > Thanks, > > Kaushik > > > > > > On Mon, Apr 4, 2011 at 4:29 AM, Erick Erickson > >wrote: > > > > > Hmmm, I think you're misunderstanding faceting. It's counting the > > > number of documents that have a particular value. So if you're > > > faceting on "comment_post_id", there is one and only one document > > > with that value (assuming that the comment_post_ids are unique). > > > Which is what's being reported.... This will be quite expensive on a > > > large corpus, BTW. > > > > > > Is your task to show the totals for *every* document in your corpus or > > > just the ones in a display page? Because if the latter, your app could > > > just count up the number of elements in the XML returned for the > > > multiValued comments field. > > > > > > If that's not relevant, could you explain a bit more why you need this > > > count? > > > > > > Best > > > Erick > > > > > > On Sun, Apr 3, 2011 at 2:31 PM, Kaushik Chakraborty < > kaychaks@gmail.com > > > >wrote: > > > > > > > Hi, > > > > > > > > My index contains a root entity "Post" and a child entity "Comments". > > > Each > > > > post can have multiple comments. data-config.xml: > > > > > > > > > > > > > > > dataSource="jdbc" query=""> > > > > > > > > > > > > > > > > > > > > query="select > > * > > > > from comments where post_id = ${posts.post_id}" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The schema has all columns of "comment" entity as "MultiValued" > fields > > > and > > > > all fields are indexed & stored. My requirement is to count the > number > > of > > > > comments for each post. Approach I'm taking is to query on "*:*" and > > > > faceting the result on "comment_post_id" so that it gives the count > of > > > > comment occurred for that post. > > > > > > > > But I'm getting incorrect result e.g. if a post has 2 comments, the > > > > multivalued fields are populated alright but the facet count is > coming > > as > > > 1 > > > > (for that post_id). What else do I need to do? > > > > > > > > > > > > Thanks, > > > > Kaushik > > > > > > > > > > --000e0cd22fe887fb1904a0136926--