Erick, yes, u r correct. But with that example I only wanted to explain Tamanjit that "matches" in solr response contains all docs which matched with group query. Tamanjit if u want the counts of docs of only first page according to "rows" parameter then that is the only way which u mentioned...iterate and count... There was small misunderstanding b/w us, I thought Tamanjit wants all matched docs, but I think he wanted to know docs matched in first page according to "rows" parameter.
On Fri, Feb 3, 2012 at 7:32 PM, Erick Erickson <erickerick...@gmail.com>wrote: > Prateesh: > > I'm not understanding here. I believe Tamanjit is correct. Your example > works if and only if *all* the groups are returned, which happens in the > example case but not in the general case. Try your experiment with > > &rows=3 and you'll find that (trunk, example) > > This search: > > http://localhost:8983/solr/select?q=*:*&group=true&group.field=manu_exact&group.ngroups=true&rows=3 > returns this (lots of stuff removed for clarity) > > <response> > <lst name="responseHeader"> > <lst name="params"> > <str name="group.field">manu_exact</str> > <str name="group.ngroups">true</str> > <str name="group">true</str> > <str name="q">*:*</str> > <str name="rows">3</str> > </lst> > </lst> > <lst name="grouped"> > <lst name="manu_exact"> > <int name="matches">28</int> > <int name="ngroups">13</int> > <arr name="groups"> > <lst> > <null name="groupValue"/> > <result name="doclist" numFound="12" start="0"> > > </result> > </lst> > <lst> > <str name="groupValue">Samsung Electronics Co. Ltd.</str> > <result name="doclist" numFound="1" start="0"> > </result> > </lst> > <lst> > <str name="groupValue">Maxtor Corp.</str> > <result name="doclist" numFound="1" start="0"> > </result> > </lst> > </arr> > </lst> > </lst> > </response> > > Sum of numfounds is different than matches. > > Or perhaps I'm misunderstanding your example... > > Best > Erick > > On Fri, Feb 3, 2012 at 12:46 AM, preetesh dubey <dubeypreet...@gmail.com> > wrote: > > Nope! > > if u r doing grouping then "matches" is always the total no. of results > and > > "ngroups" is the number of groups. Every groups can have some docs > > belonging to it which can be anything according to provided parameter > > "group.limit". If u get the sum of all the docs of each group, then it's > > equivalent to "matches". > > Ok.....u can do one experiment.....execute a simple query in solr which > > returns very few results. > > 1)execute the query *without grouping* in browser and check the xml/json > > response...it will show u the total no. of result matches as a response > in > > "numFound"...e,g. > > <result name="response" numFound="20" start="0"> > > lets say it..... > > *a)* numFound*withoutgrouping=20* > > 2) Now execute the query same *with grouping *parameters* *and* *look at > > the xml/json response in browser. it will show u the results like > this.... > > /********** > > <lst name="groupid"> > > <int name="matches">20</int> > > <int name="ngroups">12</int> > > <arr name="groups"> > > <lst> > > <str name="groupValue">4362</str> > > <result name="doclist" numFound="1" start="0">...</result> > > </lst> > > <lst> > > <str name="groupValue">3170</str> > > <result name="doclist" numFound="3" start="0">...</result> > > </lst> > > **********/ > > > > b)matcheswithgroups=20 > > > > Now do the sum of docs of every group... > > <result name="doclist" numFound="1" start="0">...</result> > > <result name="doclist" numFound="3" start="0">...</result> > > sum of numFound="1", numFound="3" ..... > > lets say > > * > > * > > *c) sumofgroups*=1+3+.......u will find a==b==c at last..... > > do that experiment and reply back...... > > > > after doing sum compare the a), b), c) > > > > On Fri, Feb 3, 2012 at 10:32 AM, tamanjit.bin...@yahoo.co.in < > > tamanjit.bin...@yahoo.co.in> wrote: > > > >> Ummm.. I think there is some confusion here. > >> > >> As per my understanding, matches is the total no of docs which the > original > >> query/filter query returned. On these docs grouping is done. So matches > may > >> not be actually equal to total no. of returned in your result, post > >> grouping. Its just a subset of the matches, divided into groups. > >> > >> Is my understanding correct? > >> > >> -- > >> View this message in context: > >> > http://lucene.472066.n3.nabble.com/Which-patch-236-to-choose-for-collapse-Solr-3-5-tp3697685p3712195.html > >> Sent from the Solr - User mailing list archive at Nabble.com. > >> > > > > > > > > -- > > Thanks & Regards > > Preetesh Dubey > -- Thanks & Regards Preetesh Dubey