Apply FacetState to a Facet


Parameter Type Default Notes
facet Required IFacet
state Required IFacetState


Property Type Notes
accordionClosed Optional boolean
aggField Optional string
aggLimit Optional number

limit of aggregates returned. Max 200

display Optional "map" | "single-select" | "multi-select" | "date-range" | "histogram"

Display for this facet. Not all facets will be compatible with all displays

field Optional string

field to generate the facet from

key Optional string

Unique key, used for query params and telemetry

label Optional string

Translated label for the facet

operation Optional "OR" | "AND"

Operation is passed into the FilterGroup that is constructed when the Facet is serialized. Implemetations should default to "OR" if not specified

optionLimit Optional number

Number of facet options to show by default. Only applies to multi-select, and defaults to all.

options Optional IFacetOption[]

Individual options for this Facet

orderBy Optional "count" | "label"

Specifies how to order the facet options. Only applies to multi-select, and defaults to count.

  • count: orders by option.count in descending order of frequency
  • label: orders by option.label in ascending alphabetical order
pageSize Optional number
state Optional "open" | "closed"

State of the Facet

type Optional "single-select" | "multi-select" | "date-range" | "histogram"

Function defined in common/src/search/_internal/state.ts:31