FacetSetActions

This is for:

Developer

The facet set action creators.

Loader Function

loadFacetSetActions

Loads the facetSet reducer and returns possible action creators.

Parameters

  • engine: SearchEngine

    The headless engine.

Returns FacetSetActionCreators: The facet set action creators.

FacetSetActionCreators

deselectAllFacetValues

Deselects all values of a facet.

Parameters

  • facetId: string

    The unique identifier of the facet (e.g., "1").

Returns PayloadAction<string>: A dispatchable action.

registerFacet

Registers a facet in the facet set.

Parameters

Returns PayloadAction<RegisterFacetActionCreatorPayload>: A dispatchable action.

toggleExcludeFacetValue

Excludes a facet value. If the value does not exist, it is added.

Parameters

Returns PayloadAction<ToggleSelectFacetValueActionCreatorPayload>: A dispatchable action.

toggleSelectFacetValue

Toggles a facet value. If the value does not exist, it is added.

Parameters

Returns PayloadAction<ToggleSelectFacetValueActionCreatorPayload>: A dispatchable action.

updateFacetAutoSelection

Updates the preventAutoSelect flag of all facets

Parameters

Returns PayloadAction<UpdateFacetAutoSelectionActionCreatorPayload>: A dispatchable action.

updateFacetIsFieldExpanded

Whether to expand (show more values than initially configured) or shrink down the facet.

Parameters

Returns PayloadAction<UpdateFacetIsFieldExpandedActionCreatorPayload>: A dispatchable action.

updateFacetNumberOfValues

Updates the number of values of a facet.

Parameters

Returns PayloadAction<UpdateFacetNumberOfValuesActionCreatorPayload>: A dispatchable action.

updateFacetSortCriterion

Updates the sort criterion of a facet.

Parameters

Returns PayloadAction<UpdateFacetSortCriterionActionCreatorPayload>: A dispatchable action.

updateFreezeCurrentValues

Updates the updateFreezeCurrentValues flag of a facet.

Parameters

Returns PayloadAction<UpdateFreezeCurrentValuesActionCreatorPayload>: A dispatchable action.

FacetValue

Properties

  • numberOfResults: number

    The number of results that have the facet value.

  • state: 'idle' | 'selected' | 'excluded'

    Whether a facet value is filtering results (selected) or not (idle).

  • value: string

    The facet value.

RegisterFacetActionCreatorPayload

Properties

  • facetId: string

    A unique identifier for the facet.

  • field: string

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

  • allowedValues?: { type: 'simple'; values: 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.

  • filterFacetCount?: boolean

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

    Default: 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

    Default: 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

    Default: 8

  • resultsMustMatch?: 'allValues' | 'atLeastOneValue'

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

    Default: atLeastOneValue

  • sortCriteria?: 'score' | 'alphanumeric' | 'alphanumericDescending' | 'occurrences' | 'automatic'

    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.

    Default: automatic

ToggleSelectFacetValueActionCreatorPayload

Properties

  • facetId: string

    The unique identifier of the facet (e.g., "1").

  • selection: FacetValue

    The target facet value.

UpdateFacetAutoSelectionActionCreatorPayload

Properties

  • allow: boolean

    Whether to allow or prevent automatic selection in all facets.

UpdateFacetIsFieldExpandedActionCreatorPayload

Properties

  • facetId: string

    The unique identifier of the facet (e.g., "1").

  • isFieldExpanded: boolean

    Whether to expand or shrink down the facet.

UpdateFacetNumberOfValuesActionCreatorPayload

Properties

  • facetId: string

    The unique identifier of the facet (e.g., "1").

  • numberOfValues: number

    The new number of facet values (e.g., 10).

UpdateFacetSortCriterionActionCreatorPayload

Properties

  • criterion: 'score' | 'alphanumeric' | 'alphanumericDescending' | 'occurrences' | 'automatic'

    The criterion by which to sort the facet.

  • facetId: string

    The unique identifier of the facet (e.g., "1").

UpdateFreezeCurrentValuesActionCreatorPayload

Properties

  • facetId: string

    The unique identifier of the facet (e.g., "1").

  • freezeCurrentValues: boolean

    Whether the values should be frozen in the next request.