happa
happa

Reputation: 93

Solr Range Facets dynamically modifying the ranges based on the search query

So here is what I am trying to do. I have a facet defined on the price field.

1) When there is a query for "wordA" I want the facets to be from 0-1000 divided in 5 intervals since my maximum price for "wordA" will never exceed 1000

2) When there is a query for "wordB" I want the facets to be from 0-50 divided in 5 intervals since my maximum price for the query "wordB" will never exceed 50.

So basically I want the facet range to change dynamically so that I don't end up with a range of 0-1000 for a query "wordB" where all the hits will lie in the 1st range.

If solr does not support this then it will be a lot of query post processing involved to modify the ranges based on the returned results.

Upvotes: 2

Views: 485

Answers (1)

MatsLindh
MatsLindh

Reputation: 52882

Solr does not support that, but you can do it yourself by doing two queries - first get the stats (max, min) for the field, then submit a query for the facet ranges (intervals) that are suitable for your application.

Upvotes: 3

Related Questions