Solr provides a Simple Faceting toolkit which can be reused by various Request Handlers to include a "Facet counts" section within a search response.
Set to "true" this param enables facet counts in the query response.
Any blank or missing value, or "false" will disable faceting.
None of the other parameters listed below will have any effect without setting this param to "true" This param allows you to specify an arbitrary query in the Lucene default syntax to generate a facet count.
By default, faceting returns a count of the unique terms for a "field", while facet.query allows you to determine counts for arbitrary terms or expressions.
This parameter can be specified multiple times to indicate that multiple queries should be used as separate facet constraints.
It can be particularly useful for numeric range based facets, or prefix based facets -- see example below (i.e.
To specify facet queries not in the Lucene default query syntax, prefix the facet query with the name of the query notation, a la Local Params.
For example, to use the hypothetical myfunc query parser, send parameter after any Analysis occurs.
For text fields that include stemming, or lowercasing, or word splitting you may not get what you expect.
If you want both Analysis (for searching) and Faceting on the full literal Strings, use copy Field to create two versions of the field: one Text and one String.
Make sure both are Limits the terms on which to facet to those starting with the given string prefix.