Here is an example using exampledocs and trunk 4.0:

http://localhost:8983/solr/select/?q=cat:%22hard%20drive%22&version=2.2&sta
rt=0&rows=10&indent=on&facet=true&facet.field=cat&facet.query={!lucene}cat:
%22hard%20drive%22&facet.mincount=1

Results:

<result name="response" numFound="2" start="0">
Etc....
<lst name="facet_queries">
<int name="{!lucene}cat:"hard drive"">2</int>
</lst>
<lst name="facet_fields">
<lst name="cat">
    <int name="electronics">2</int>
    <int name="hard drive">2</int>
</lst></lst>

Notice that the facet_queries count "2" is the same as the the numFound=2.

But I have no way to use facet.field to count the matches.

The algorithm -

Loop through multiValued field and match on "hard drive". Ignore other
values in there when setting the facet list....




On 6/22/11 1:19 AM, "Dennis de Boer" <datdeb...@gmail.com> wrote:

>Hi Bill,
>
>yes, you absolutely do make sense. I posted the exact same question to
>this
>mailing list (subject: faceting on multivalued fields), but got no
>response
>out of it. A friend of mine is now helping out.
>
>I hope someone on the list can give us some advice. I'll post our findings
>to this topic.
>
>Regards,
>Dennis
>
>
>On Wed, Jun 22, 2011 at 5:37 AM, Bill Bell <billnb...@gmail.com> wrote:
>
>> Doing it with q=specialities:Cardiologist or
>> q=Cardiologist&defType=dismax&qf=specialties
>> does not matter, the issue is how I see facets. I want the facets to
>>only
>> show the one match,
>> and not all the multiValued fields in specialties that match...
>>
>> Example,
>>
>> Name|specialties
>> Bell|Cardiologist
>> Smith|Cardiologist,Family Doctor
>> Adams,Cardiologist,Family Doctor,Internist
>>
>> When I facet.field=specialties I get:
>>
>> Cardiologist: 3
>> Internist: 1
>> Family Doctor: 1
>>
>>
>> I only want it to return:
>>
>> Cardiologist: 3
>>
>> Because this matches exactly... Facet on the field that matches and only
>> return the number for that.
>>
>> It can get more complicated. Here is another example:
>>
>> q=cardiology&defType=dismax&qf=specialties
>>
>>
>> (Cardiology and cardiologist are stems)...
>>
>> But I don't really know which value in Cardiologist match perfectly.
>>
>> Again, I only want it to return:
>>
>> Cardiologist: 3
>>
>> If I searched on q=internist&defType=dismax&qf=specialties, I want the
>> result to be:
>>
>>
>> Internist: 1
>>
>>
>> Does this all make sense?
>>
>>
>>
>>
>>
>>
>>
>> On 6/21/11 8:23 PM, "Darren Govoni" <dar...@ontrenet.com> wrote:
>>
>> >So are you saying that for all results for "cardiologist",
>> >you don't want facets not matching "Cardiologist" to be
>> >returned as facets?
>> >
>> >what happens when you make q=specialities:Cardiologist?
>> >instead of just q=Cardiologist?
>> >
>> >Seems that if you make the query on the field, then all
>> >your results will necessarily qualify and you can discard
>> >any additional facets you don't want (e.g. that don't
>> >match the initial query term).
>> >
>> >Maybe you can write what you see now, with what you
>> >want to help clarify.
>> >
>> >On 06/21/2011 09:47 PM, Bill Bell wrote:
>> >> I have a field: specialties that is multiValued.
>> >>
>> >> It indicates the doctor's specialties: cardiologist, internist, etc.
>> >>
>> >> When someone does a search: "Cardiologist", I use
>> >>
>> 
>>>>q=cardiologist&defType=dismax&qf=specialties&facet=true&facet.field=spe
>>>>ci
>> >>alt
>> >> ies
>> >>
>> >> What I want to come out in the facet is the Cardiologist (since it
>> >>matches
>> >> exactly) and the number that matches: 700.
>> >> I don't want to see the other values that are not Cardiologist.
>> >>
>> >> Now I see:
>> >>
>> >> Cardiologist: 700
>> >> Internist: 45
>> >> Family Doctor: 20
>> >>
>> >> This means that several Cardiologist's are also internists and family
>> >> doctors. When it matches exactly, I don't want to see Internists,
>>Family
>> >> Doctors. How do I send a query to Solr with a condition.
>> >> Facet.query=specialties:Cardiologist&facet.field=specialties
>> >>
>> >> Then if the query returns something use it, otherwise use the field
>>one?
>> >>
>> >> Other ideas?
>> >>
>> >>
>> >>
>> >>
>> >
>>
>>
>>


Reply via email to