lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Restricting Facet to FilterQuery in combination with mincount
Date Tue, 19 Jan 2010 22:27:39 GMT

: Now, I was wondering whether it is possible to find that out. It would allow
: to show 0 counts of values that are produced by the query (q), and at the same
: time exclude all facet values that are already excluded by the filter query.
: Applying facetting to a subset (subselect / filterset) of the index not to
: everything - that might describe it, as well.

you can "tag" a filter query so that face.tfield knows to ignore that fq 
when computing the constraint counts...

...but i'm pretty sure that still won't give you what you are looking for. 
In your "mammal" example it would just mean that the counts for your 
"name" facet would ignore the "fq=type:mammal" restriction and be based 
purely on the main q=area:water query ... so instead of "excluding" 
salmon(0) from the results, and leaving lion(0) and dog(0) you would get 
presumably start getting a positive count for "salmon", but lin and dog 
still wouldn't match....

: > > q=area:water&fq=type:mammal&facet.field=name&facet.mincount=0
: > > 
: > > would return something like
: > > dolphin (20)
: > > blue whale (20)
: > > salmon (0) <= not covered by filter query
: > > lion (0)
: > > dog (0)

...even if you sqaped the fq and q (which would alter your scores 
drasticly) what taging and excluding changes is the *counts* associated 
with a facet value -- there is no way to get "some zeros" to show while 
"other zeros" don't.

Typically the driving force behind something like this is a hierarchical 
taxonomy -- your animal example fitting nicely.  In those cases, you can 
make your facets use the full hierarch (ie: mammal/lion, mammal/dog, 
fish/salmon instead of just lion/dog/salmon) and you can use facet.prefix 
to get the type of behavior you are talking about.


View raw message