Interval faceting

Interval faceting is similar to range faceting, but it allows us to set variable intervals and count the number of documents that have values within those intervals in the specified field. Interval faceting is likely to be better with multiple intervals for the same fields, while a facet query is likely to be better in environments where a filter cache is more effective:

Parameter Behavior Default value

facet.interval

To specify a field where we want to apply the interval. It can be used multiple times for multiple fields in a single request. For example:

facet.interval=price&facet.interval=popularity

facet.interval.set

To specify a set of intervals for the field. It can be specified multiple times to indicate multiple intervals. For example:

f.price.facet.interval.set=[0,10]&f.price.facet.interval.set=(10,100]

(1,100) -> include values greater than 1 and lower than 100
[1,100) -> include values greater or equal to 1 and lower than 100
[1,100] -> include values greater or equal to 1 and lower or equal to 100

 

Example: Faceting query for field price >=10 and price < 20

URLhttp://localhost:8983/solr/techproducts/select?q=*:*&facet=true&facet.interval=price&f.price.facet.interval.set=[10,20)

Response:

"facet_counts":{
"facet_queries":{},
"facet_fields":{},
"facet_ranges":{},
"facet_intervals":{
"price":{
"[10,20)":2}},
"facet_heatmaps":{}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.184.126