Solr has built-in support for faceting numeric and date fields by a range and a divided interval. You can think of this as a convenience feature that calculates the ranges for you with succinct input parameters and output, rather than you calculating and submitting a series of facet queries—facet queries are described after this section.
Range faceting is particularly useful for dates. We'll demonstrate an example against MusicBrainz release dates and another against MusicBrainz track durations, and then describe the parameters and their options.
Note
Date faceting
is the date-specific predecessor of range faceting and is deprecated as of Solr 3. Date faceting uses similar parameters starting with facet.date
and has similar output under facet_dates
.
Here's the URL:
http://localhost:8983/solr/mbreleases/mb_releases?indent=on&wt=json&omitHeader=true&rows=0&facet=true&facet.range.other=all&f.r_event_date_earliest.facet.range.start=NOW/YEAR...