Sorry to jump into this thread, but are you saying that the facet count is not # of result hits?
So if I have 1 document with field CAT that has 10 values and I do a query that returns this 1 document with faceting, that the CAT facet count will be 10 not 1? I don't seem to be seeing that behavior in my app (Solr 3.5). Thanks. > OK, I'm not understanding here. You get the counts and the results if you > facet > on a single category field. The facet counts are the counts of the > *values* in that > field. So it would help me if you showed the output of faceting on a > single > category field and why that didn't work for you.... > > But either way, faceting will probably outperform grouping. > > Best > Erick > > On Mon, Dec 5, 2011 at 9:05 AM, Juan Pablo Mora <jua...@informa.es> wrote: >> Because I need the count and the result to return back to the client >> side. Both the grouping and the facet offers me a solution to do that, >> but my doubt is about performance ... >> >> With Grouping my results are: >> >> "grouped":{ >> "category":{ >> "matches": ..., >> "groups":[{ >> "groupValue":"categoryXX", >> "doclist":{"numFound":Important_number,"start":0,"docs":[ >> { >> doc:id >> category:XX >> } >> "groupValue":"categoryYY", >> "doclist":{"numFound":Important_number,"start":0,"docs":[ >> { >> doc: id >> category:YY >> } >> >> And with faceting my results are : >> "facet.prefix=whatever" >> "facet_counts":{ >> "facet_queries":{}, >> "facet_fields":{ >> "namesXX":[ >> "whatever_name_in_category",76, >> ... >> "namesYY":[ >> "whatever_name_in_category",76, >> ... >> >> Both results are OK to me. >> >> >> ________________________________________ >> De: Erick Erickson [erickerick...@gmail.com] >> Enviado el: lunes, 05 de diciembre de 2011 14:48 >> Para: solr-user@lucene.apache.org >> Asunto: Re: Grouping or Facet ? >> >> Why not just use the first form of the document >> and just facet.field=category? You'll get >> two different facet counts for XX and YY >> that way. >> >> I don't think grouping is the way to go here. >> >> Best >> Erick >> >> On Sat, Dec 3, 2011 at 6:43 AM, Juan Pablo Mora <jua...@informa.es> >> wrote: >>> I need to do some counts on a StrField field to suggest options from >>> two different categories, and I don´t know what option is the best: >>> >>> My schema looks: >>> >>> - id >>> - name >>> - category: XX or YY >>> >>> with Grouping I do: >>> >>> http://localhost:8983/?q=name:prefix*&group=true&group.field=category >>> >>> But I can change my schema to to: >>> >>> - id >>> - nameXX >>> - nameYY >>> - category: XX or YY (only 1 value in nameXX or nameYY) >>> >>> With facet: >>> http://localhost:8983/?q=*:*&facet=true&facet.field=nameXX&facet.field=nameYY&facet.prefix=prefix >>> >>> >>> What option have the best performance ? >>> >>> Best, >>> Juampa. >