Sorry if I don´t explain my problem clearly...
I need to do a suggester of names based on a prefix. My data are from two
categories of people, admins and developers for example. So when the client
write "SAN" my results should be:
Prefix: San
Developers: Sanchez Garcia, Juan (5)
Sanchez Roman, Ivan (2)
San...
Admins: Sanchez, Pedro (7)
Sanchez Garcia, Javier (2)
And the most common a name is, the upper position will have. So I think is not
posible to do that with grouping. So finally my schema will be:
id
nameDeveloper or nameAdmin : both String fields, but only one will have values
in a doc.
And my query with facet will be:
/q=*:*&facet=true&facet.field=nameDeveloper&facet.field=nameAdmin&facet.prefix=SAN&facet.minCounts=1
If I try to do that with grouping I need something like
group.pivot=category,name , and is not posible in Solr yet.
Best,
Juampa.
El 08/12/2011, a las 02:23, Darren Govoni escribió:
> Yes. That's what I would expect. I guess I didn't understand when you said
>
> "The facet counts are the counts of the *values* in that field"
>
> Because it seems its the count of the number of matching documents
> irrespective
> if one document has 20 values for that field and another 10, the facet count
> will be 2,
> one for each document in the results.
>
> On 12/07/2011 09:04 AM, Erick Erickson wrote:
>> In your example you'll have 10 facets returned each with a value of 1.
>>
>> Best
>> Erick
>>
>> On Tue, Dec 6, 2011 at 9:54 AM,<[email protected]> wrote:
>>> 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<[email protected]> 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 [[email protected]]
>>>>> Enviado el: lunes, 05 de diciembre de 2011 14:48
>>>>> Para: [email protected]
>>>>> 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<[email protected]>
>>>>> 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.
>