Reputation: 23171
For a facet Solr search that returns multiple facet.field
, is there a way to group one of those fields into ranges?
For example:
'facet': true,
'facetJson': {},
'facet.query': query,
'facet.mincount': 1,
'facet.field': ['field1', 'field2'],
For field2
, it returns lots of different numbers, and I'd like to group it into buckets:
[0]: 50,
[1 - 1000]: 75,
[1001 - 5000]: 80
I see there's a facet.range=field2
, but unsure of how I'd use this multiple times for 2+ different field ranges?
Upvotes: 0
Views: 377
Reputation: 52802
You can use the syntax <field>.facet.<property>
to give specific properties for each field (or you can use the JSON Facet API).
However, since you want arbitrary ranges (and not even intervals), you'll have to use facet.query
instead of facet.range
:
facet.query=field2:0&
facet.query=field2:[1 TO 1000]&
facet.query=field2:[1001 TO 5000]&
facet.query=field2:[5001 TO *]
Upvotes: 1