Sergey
Sergey

Reputation: 963

Solr range not filtering

I am trying to use price.facet.range, but it doesn't work, it always returns unfiltered results

indexing:

<field name="price" type="sdouble" indexed="true" stored="false" multiValued="true" /> 

solrDoc.addField("price", 22.99);

creating query:

query.addNumericRangeFacet("price", 0.0 ,100.0, 0.01);

created query:

q=mobile+phone&
fl=productId+score&
payload=true&
payload.fl=full_text&
facet.range=price&
f.price.facet.range.start=0.0&
f.price.facet.range.end=100.0&
f.price.facet.range.gap=0.01&
facet=true&
/...

Upvotes: 0

Views: 780

Answers (2)

Sergey
Sergey

Reputation: 963

I found solution

query.addFilterQuery("price:[0 100]");

Upvotes: 2

David Smiley
David Smiley

Reputation: 4150

Faceting always operates on filtered results ('fq' & 'q' params), unless you explicitly exclude a filter query which you didn't. Can you reproduce the problem with the exampledocs data in Solr, or with a setup that is easy for another person to verify?

Upvotes: 0

Related Questions