Skip to main content
The JSON Facets query pipeline stage adds field facets and range facets to the Solr query using the Solr JSON Facet API. The stage combines all of the facets you configure into a single 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.
Solr returns JSON facet results under 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.
Use these fields to change the order of values within a facet:
  • 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 that aren’t listed keep the order that Solr returns. Boost, bury, and suppress require a Modify Response stage in the same pipeline. Place the Modify Response stage after both the JSON Facets stage and the Solr Query stage. If the Modify Response stage is missing or runs before either of those stages, the facet values aren’t reordered. Keep these matching rules in mind:
  • 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 the json.facet parameter that the stage adds to the Solr request.
Configure a field facet with Field name set to color and all other settings left at their defaults.The stage adds this parameter:
In eCommerce catalogs, one product often has several SKUs. To count products in each bucket, configure a field facet with Field name set to color and Rollup field count set to prod_name_s.The stage adds a nested facet to the color facet:
Each bucket in the response includes both the document count and the number of unique products.
To let users select more than one color, configure a field facet with Field name set to color and enable Filter exclusion.The stage adds this to the color facet:
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.
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:
To return buckets that match no documents, enable Display Zero Count Values. This sets the minimum count to 0 and overrides the Minimum count setting.

Configuration

When entering configuration values in the UI, use unescaped characters, such as \t for the tab character. When entering configuration values in the API, use escaped characters, such as \\t for the tab character.