Question

What would be the best way to implement a custom range filter using Solr? I.e. I want to show a filter "Harddrive" (for PC's), which can have a value in the range from 32GB to 2TB. I want these values to be added to the query to Solr as a range-facet.

What will be the solr query?

Was it helpful?

Solution

Assuming you've indexed your document with key="size" and the value is in megabytes and you want to query the range 32GB to 2TB:

    http://[solrnet:8080]/solr/search?q=size:[32000 TO 2000000]

In other words: you need to translate 32GB and 2TB to the appropriate number of megabytes yourself, before constructing the query.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top