AW: Restricting Facet to FilterQuery in combination with mincount
Thank you, Chris! That did clarify it. :-) Cheers, Chantal Von: Chris Hostetter [hossman_luc...@fucit.org] Gesendet: Dienstag, 19. Januar 2010 23:27 An: solr-user@lucene.apache.org Betreff: Re: Restricting Facet to FilterQuery in combination with mincount : 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... http://wiki.apache.org/solr/SimpleFacetParameters#LocalParams_for_faceting ...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:waterfq=type:mammalfacet.field=namefacet.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. -Hoss
Re: Restricting Facet to FilterQuery in combination with mincount
On Wed, Jan 13, 2010 at 4:55 PM, Chantal Ackermann chantal.ackerm...@btelligent.de wrote: Hi all, is it possible to restrict the returned facets to only those that apply to the filter query but still use mincount=0? Keeping those that have a count of 0 but apply to the filter, and at the same time leaving out those that are not covered by the filter (and thus 0, as well). Some longer explanation of the question: Example (don't nail me down on biology here, it's just for illustration): q=type:mammalfacet.mincount=0facet.field=type returns facets for all values stored in the field type. Results would look like: mammal(2123) bird(0) dinosaur(0) fish(0) ... In this case setting facet.mincount=1 solves the problem. But consider: q=area:waterfq=type:mammalfacet.field=namefacet.mincount=0 would return something like dolphin (20) blue whale (20) salmon (0) = not covered by filter query lion (0) dog (0) ... (all sorts of animals, every possible value in field name) My question is: how can I exclude those facets from the result that are not covered by the filter query. In this example: how can I exclude the non-mammals from the facets but keep all those mammals that are not matched by the actual query parameter? I've read this twice but the problem is still not clear to me. I guess you will have to explain it better to get a meaningful response. -- Regards, Shalin Shekhar Mangar.
Re: Restricting Facet to FilterQuery in combination with mincount
Hi Shalin, thanks for taking your time (reading it twice!). Rephrasing the question: (suppose mincount=0 and facet.limit all possible facet values) Currently, the facet results include ALL values for that facet field. Say I have a field color and when I look at the statistics (LUKE), I can see that my index contains altogether 7 different colors. This is comparable to a group/count/distinct query in a SQL db. Querying for color as facet field with mincount=0 should thus return 7 facet fields with various count results. This fact (7 different counts returned for color) will not change no matter what the query (q) or the filter queries (fq) are - unless I change mincount. Is that correct? If so, then I was considering the cases why a facet count would be 0 (always suppose mincount=0). Case 1) No hit as defined by the query (q parameter) contains that specific facet value (e.g. the colors blue and green). Case 2) This is like Case (1) but there is a filterquery on top, that excludes certain values from the facet field, so even before q is executed, it's clear that certain facet values are 0. (e.g. the filter includes only hits with colors yellow and orange. So, by this filter, documents with the colors blue and green are already excluded from the set that is considered for the actual query (q).) For me, this results in two different flavours of 0 counts: either the 0 is the result of executing the query (q) or a result of a filterquery. 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. Does that make sense? Thanks, Chantal Shalin Shekhar Mangar schrieb: On Wed, Jan 13, 2010 at 4:55 PM, Chantal Ackermann chantal.ackerm...@btelligent.de wrote: Hi all, is it possible to restrict the returned facets to only those that apply to the filter query but still use mincount=0? Keeping those that have a count of 0 but apply to the filter, and at the same time leaving out those that are not covered by the filter (and thus 0, as well). Some longer explanation of the question: Example (don't nail me down on biology here, it's just for illustration): q=type:mammalfacet.mincount=0facet.field=type returns facets for all values stored in the field type. Results would look like: mammal(2123) bird(0) dinosaur(0) fish(0) ... In this case setting facet.mincount=1 solves the problem. But consider: q=area:waterfq=type:mammalfacet.field=namefacet.mincount=0 would return something like dolphin (20) blue whale (20) salmon (0) = not covered by filter query lion (0) dog (0) ... (all sorts of animals, every possible value in field name) My question is: how can I exclude those facets from the result that are not covered by the filter query. In this example: how can I exclude the non-mammals from the facets but keep all those mammals that are not matched by the actual query parameter? I've read this twice but the problem is still not clear to me. I guess you will have to explain it better to get a meaningful response. -- Regards, Shalin Shekhar Mangar.
Re: Restricting Facet to FilterQuery in combination with mincount
: 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... http://wiki.apache.org/solr/SimpleFacetParameters#LocalParams_for_faceting ...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:waterfq=type:mammalfacet.field=namefacet.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. -Hoss
Restricting Facet to FilterQuery in combination with mincount
Hi all, is it possible to restrict the returned facets to only those that apply to the filter query but still use mincount=0? Keeping those that have a count of 0 but apply to the filter, and at the same time leaving out those that are not covered by the filter (and thus 0, as well). Some longer explanation of the question: Example (don't nail me down on biology here, it's just for illustration): q=type:mammalfacet.mincount=0facet.field=type returns facets for all values stored in the field type. Results would look like: mammal(2123) bird(0) dinosaur(0) fish(0) ... In this case setting facet.mincount=1 solves the problem. But consider: q=area:waterfq=type:mammalfacet.field=namefacet.mincount=0 would return something like dolphin (20) blue whale (20) salmon (0) = not covered by filter query lion (0) dog (0) ... (all sorts of animals, every possible value in field name) My question is: how can I exclude those facets from the result that are not covered by the filter query. In this example: how can I exclude the non-mammals from the facets but keep all those mammals that are not matched by the actual query parameter? Thanks! Chantal