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.