Okay, so since you put "cardiologist" in the 'q', you only want facet values that have 'cardiologist' (or 'Cardiologist') to show in up the facet list.

In general, there's no good way to do that.

But.

If you want to do some client-side processing before you submit the query to Solr, and on the client side you can figure out exactly what you want: then you could try to play around with facet.filter or facet.query, to see if you can make it do what you want. It may or may not work out, depending on exactly your use pattern, which you still haven't articulated very well, but you can mess around with it and see what you can do.

Ie, if you KNOW (that is, your own app code knows, when creating the Solr request) that you only want the facet value for "Cardiologist" (including exact case), you can try facet.query=specialty:Cardiologist

Your app code would have to pull out the results special too, they won't be in the Solr response in same way ordinary facet.field is. It also requires your query value to match _exactly_ (case, punctuation, etc) the value in the index. Not "cardiologist" and "Cardiologist".

I think Solr 3.1 has some regex based facet.filter abilities that might be useful, and help you get around the 'exact match' issues, but watch out for performance.




On 6/21/2011 11:37 PM, Bill Bell 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=speci
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