json.facet request parameter, with one entry per field.
If you configure more than one facet on the same field, the later facet overwrites the earlier one.
Compared to the Field Facet stage, the JSON Facets stage supports these additional options:
- Rollup field count. Count unique values of another field in each bucket, such as the number of products instead of the number of SKUs.
- Filter exclusion. Keep all facet values visible after a user selects one, so users can select more than one value.
- Display Zero Count Values. Return buckets that match no documents.
facets.FIELD_NAME.buckets in the response, not under facet_counts.
For more information about faceting in Lucidworks Search, see Faceting.
Boost, bury, and suppress facet values
The Boost Values, Bury Values, Suppress Values, and Display Order fields are available in Lucidworks Search 5.17 and later.
- Boost Values. Move these values to the top of the facet, in the order you list them.
- Bury Values. Move these values to the bottom of the facet.
- Suppress Values. Remove these values from the facet.
- Values must exactly match the facet values that Solr returns. Matching is case-sensitive and doesn’t support partial matches.
- If a value appears in Suppress Values and in Boost Values or Bury Values, the value is suppressed.
- Don’t list the same value in both Boost Values and Bury Values.
Facet display order
Use Display Order to control the order in which facets appear in the response. Facets with lower values appear first. Facets without a value appear after all ordered facets. Display Order doesn’t require a Modify Response stage.Stage configuration examples
These examples show the stage configuration and thejson.facet parameter that the stage adds to the Solr request.
Basic field facet
Basic field facet
Configure a field facet with Field name set to
color and all other settings left at their defaults.The stage adds this parameter:Count products instead of SKUs
Count products instead of SKUs
In eCommerce catalogs, one product often has several SKUs.
To count products in each bucket, configure a field facet with Field name set to Each bucket in the response includes both the document count and the number of unique products.
color and Rollup field count set to prod_name_s.The stage adds a nested facet to the color facet:Multiselect facet
Multiselect facet
To let users select more than one color, configure a field facet with Field name set to Your search application must tag the filter query with the same name as the field.
For example:If the filter query isn’t tagged, the facet doesn’t exclude the filter.
color and enable Filter exclusion.The stage adds this to the color facet:Range facet
Range facet
Configure a range facet with Field name set to
price, Range start set to 0, Range end set to 50, and Range gap set to 10.The stage adds this parameter:0 and overrides the Minimum count setting.