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 36DB318948 for ; Thu, 9 Jul 2015 05:46:46 +0000 (UTC) Received: (qmail 82203 invoked by uid 500); 9 Jul 2015 05:46:42 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 82140 invoked by uid 500); 9 Jul 2015 05:46:42 -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 Delivered-To: moderator for solr-user@lucene.apache.org Received: (qmail 77880 invoked by uid 99); 9 Jul 2015 05:45:35 -0000 X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.879 X-Spam-Level: ** X-Spam-Status: No, score=2.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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=hX65yIKNsJRYWwedbogsE7Oo1la3jj2vQvq9K/hS8Ag=; b=LWdogFX2jdu5ruIKQpCzW7Hv+5JvnHCp71omNCMjJyGUi2kjVvBRCWskNN/KyzZrPv erbMuTjaLXkYWG+G3W6UNbIiwWj5eG1bEG1DMDfLtGs6kpzyBst2W1QTBMTlW6FYRPrT BdHu0w4XTCsJ+VhBJipMeb2oxLoyqutHILKaqNJkhy7+OrXZqEIjTdxKSc7m79exFBTA sI6TK/fluEsJeMao9RA/zJ+q5+oH8HZz2zIPuyf6zRnqqNbygheFD92HEHpZTU/IpVji LghKiCfFY2IanT5Ch2tEd/eu0B6szF3piKEnE0k6jGKGbH1dQR27kxCH4SVFjnekdyXt 7PjA== MIME-Version: 1.0 X-Received: by 10.152.2.38 with SMTP id 6mr13151451lar.80.1436420730063; Wed, 08 Jul 2015 22:45:30 -0700 (PDT) In-Reply-To: References: Date: Thu, 9 Jul 2015 11:15:29 +0530 Message-ID: Subject: Re: Grouping and recip function not working with Sharding From: Pankaj Sonawane To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=089e013c6b925d12c9051a6ac36a --089e013c6b925d12c9051a6ac36a Content-Type: text/plain; charset=UTF-8 Hi Erick, Below example is for grouping issue not for sorting. I have indexed 1839 records with 'NAME' field in all, There may be duplicate record for each 'NAME' value. Let say There are 5 records with NAME='A-SERIES',similarly 3 records with NAME='E-SERIES' etc. I have total 264 unique NAME values. So when I query collection using grouping it should return 264 unique groups with "ngroups" value as 264. But query returns response with "ngroups" as 558, however length of "groups" array in response is 264. { "responseHeader":{ "status":0, "QTime":19, "params":{ "group.ngroups":"true", "indent":"true", "q":"*:*", "group.field":"NAME", "group":"true", "wt":"json" } }, "grouped":{ "NAME":{ "matches":1839, "ngroups":558, ----- This value should be 264 "groups":[ { "groupValue":"A-SERIES", "doclist":{ } }, { "groupValue":"B-SERIES", "doclist":{ } }, { "groupValue":"C-SERIES", "doclist":{ } }, -----------Similarly there are total 264 such groups---- ] } } } >From the reference guide: group.ngroups and group.facet require that all documents in each group must be co-located on the same shard in order for accurate counts to be returned. Document routing via composite keys can be a useful solution in many situations. It's not clear what you think the prolbem here is. You say: bq: Ex: Below response contains 5 groups (Which is correct) but ngroups is 11. But you have rows set to 5 so? As far as your sorting issue, again an example showing what you think is wrong would be very helpful. Best, Erick On Wed, Jul 8, 2015 at 6:38 AM, Pankaj Sonawane wrote: > Hi, > > I am using sharding (3 shards) with Zookeeper. > > When I query a collection using " > *group=true&group.field=NAME&group.ngroups=true*" parameters, "*ngroups*" in > response is incorrect. However I am getting correct count in doclist array. > > Ex: Below response contains 5 groups (Which is correct) but ngroups is 11. > > { > "responseHeader":{ > "status":0, > "QTime":49, > "params":{ > "group.ngroups":"true", > "indent":"true", > "start":"0", > "q":"*:*", > "group.field":"NAME", > "group":"true", > "wt":"json", > "rows":"5" > } > }, > "grouped":{ > "NAME":{ > "matches":18, > "ngroups":11, > "groups":[ > { > "groupValue":"A-SERIES", > "doclist":{ > "numFound":5, > "start":0, > "maxScore":1, > "docs":[ > { > "NAME":"A-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"B-SERIES", > "doclist":{ > "numFound":5, > "start":0, > "docs":[ > { > "NAME":"B-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"C-SERIES", > "doclist":{ > "numFound":1, > "start":0, > "docs":[ > { > "NAME":"C-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"D-SERIES", > "doclist":{ > "numFound":5, > "start":0, > "docs":[ > { > "NAME":"D-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"E-SERIES", > "doclist":{ > "numFound":3, > "start":0, > "maxScore":1, > "docs":[ > { > "NAME":"E-SERIES", > "_version_":1505559209034383400 > } > ] > } > } > ] > } > } > } > > I am facing same problem with Recip function to get latest record on some > date field when using sharding. It returns back records in wrong order. > > Note: Same configuration works fine on single machine without sharding. > > Please Help me to find solution. > > Thanks. On Wed, Jul 8, 2015 at 7:08 PM, Pankaj Sonawane wrote: > Hi, > > I am using sharding (3 shards) with Zookeeper. > > When I query a collection using " > *group=true&group.field=NAME&group.ngroups=true*" parameters, "*ngroups*" in > response is incorrect. However I am getting correct count in doclist array. > > Ex: Below response contains 5 groups (Which is correct) but ngroups is 11. > > { > "responseHeader":{ > "status":0, > "QTime":49, > "params":{ > "group.ngroups":"true", > "indent":"true", > "start":"0", > "q":"*:*", > "group.field":"NAME", > "group":"true", > "wt":"json", > "rows":"5" > } > }, > "grouped":{ > "NAME":{ > "matches":18, > "ngroups":11, > "groups":[ > { > "groupValue":"A-SERIES", > "doclist":{ > "numFound":5, > "start":0, > "maxScore":1, > "docs":[ > { > "NAME":"A-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"B-SERIES", > "doclist":{ > "numFound":5, > "start":0, > "docs":[ > { > "NAME":"B-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"C-SERIES", > "doclist":{ > "numFound":1, > "start":0, > "docs":[ > { > "NAME":"C-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"D-SERIES", > > ... > > [Message clipped] --089e013c6b925d12c9051a6ac36a--