Lijo Abraham
Lijo Abraham

Reputation: 881

How to exclude a facet range field using SOLR?

I have a product_rating field in solr which is like below

<int name="product_rating:[4 TO 5]">6</int>
<int name="product_rating:[3 TO 5]">8</int>
<int name="product_rating:[2 TO 5]">9</int>
<int name="product_rating:[1 TO 5]">14</int>

So If I select anyone of this filter ,I don't want to change the facet count.But If I select any filter other than product_rating I want to change this filter count.How will this possible? (Actually I want to know how solr exclude work in facet range). plz help :)

I used this query but not working

q=*&fq={!tag=dt}product_rating:[4%20TO%205]&facet.field={!ex=dt}product_rating

Upvotes: 1

Views: 779

Answers (1)

MatsLindh
MatsLindh

Reputation: 52892

This works as you've tried and as the manual says, but you have to remember that you're using facet.range to provide your field name - not facet.field.

facet.range={!ex=dt}id&..&fq={!tag=dt}id:[0 TO 100000]

.. gives the expected result (where the counts for the facet is unaffected by the fq).

Upvotes: 1

Related Questions