interface FacetOptions {
    allowedValues?: string[];
    customSort?: string[];
    facetId?: string;
    facetSearch?: FacetSearchOptions;
    field: string;
    filterFacetCount?: boolean;
    hasBreadcrumbs?: boolean;
    injectionDepth?: number;
    numberOfValues?: number;
    resultsMustMatch?: FacetResultsMustMatch;
    sortCriteria?: FacetSortCriterion;
    tabs?: { excluded?: string[]; included?: string[] };
}

Properties

allowedValues?: string[]

Specifies an explicit list of allowedValues in the Search API request.

If you specify a list of values for this option, the facet uses only these values (if they are available in the current result set).

The maximum amount of allowed values is 25.

Default value is undefined, and the facet uses all available values for its field in the current result set.

customSort?: string[]

Identifies the facet values that must appear at the top, in this order. This parameter can be used in conjunction with the sortCriteria parameter.

Facet values not part of the customSort list will be sorted according to the sortCriteria.

The maximum amount of custom sort values is 25.

The default value is undefined, and the facet values will be sorted using only the sortCriteria.

facetId?: string

A unique identifier for the controller. By default, a random unique identifier is generated.

facetSearch?: FacetSearchOptions

Facet search options.

field: string

The field whose values you want to display in the facet.

filterFacetCount?: boolean

Whether to exclude the parents of folded results when estimating the result count for each facet value.

true

hasBreadcrumbs?: boolean

Specifies whether breadcrumbs appear for the facet

true

injectionDepth?: number

The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.

Note: A high injectionDepth may negatively impact the facet request performance.

Minimum: 0

1000

numberOfValues?: number

The number of values to request for this facet. Also determines the number of additional values to request each time this facet is expanded, and the number of values to display when this facet is collapsed.

Minimum: 1

8

resultsMustMatch?: FacetResultsMustMatch

The criterion to use for specifying how results must match the selected facet values.

atLeastOneValue

sortCriteria?: FacetSortCriterion

The criterion to use for sorting returned facet values.

The sortCriteria option does not apply when making a facet search request. It is only used for sorting returned facet values during a regular Coveo search request.

Learn more about sortCriteria values and the default behavior of specific facets in the Search API documentation.

automatic

tabs?: { excluded?: string[]; included?: string[] }

The tabs on which the facet should be enabled or disabled.