The Facet controller allows you to create a search interface component that the end user can use to refine a query by selecting filters based on item metadata (i.e., field values). If you have enabled a Dynamic Navigation Experience (DNE) model, the Facet controller automatically reorders facet values according to the user query.

Examples:

interface Facet {
    facetSearch: FacetSearch;
    state: FacetState;
    deselectAll(): void;
    disable(): void;
    enable(): void;
    isSortedBy(criterion: FacetSortCriterion): boolean;
    isValueExcluded(value: FacetValue): boolean;
    isValueSelected(value: FacetValue): boolean;
    showLessValues(): void;
    showMoreValues(): void;
    sortBy(criterion: FacetSortCriterion): void;
    subscribe(listener: () => void): Unsubscribe;
    toggleExclude(selection: FacetValue): void;
    toggleSelect(selection: FacetValue): void;
    toggleSingleExclude(selection: FacetValue): void;
    toggleSingleSelect(selection: FacetValue): void;
}

Hierarchy (View Summary)

Methods

  • Deselects all facet values.

    Returns void

  • Disables the facet. I.e., prevents it from filtering results.

    Returns void

  • Enables the facet. I.e., undoes the effects of disable.

    Returns void

  • Checks whether the facet values are sorted according to the specified criterion.

    Parameters

    Returns boolean

    Whether the facet values are sorted according to the specified criterion.

  • Checks whether the specified facet value is excluded.

    Parameters

    Returns boolean

    Whether the specified facet value is excluded.

  • Checks whether the specified facet value is selected.

    Parameters

    Returns boolean

    Whether the specified facet value is selected.

  • Sets the number of values displayed in the facet to the originally configured value.

    Returns void

  • Increases the number of values displayed in the facet to the next multiple of the originally configured value.

    Returns void

  • Sorts the facet values according to the specified criterion.

    Parameters

    Returns void

  • Adds a callback that's invoked on state change.

    Parameters

    • listener: () => void

      A callback that's invoked on state change.

    Returns Unsubscribe

    A function to remove the listener.

  • Toggles exclusion of the specified facet value.

    Parameters

    • selection: FacetValue

      The facet value to toggle exclusion.

    Returns void

  • Toggles the specified facet value.

    Parameters

    Returns void

  • Excludes the specified facet value, deselecting others.

    Parameters

    • selection: FacetValue

      The facet value to toggle exclusion.

    Returns void

  • Toggles the specified facet value, deselecting others.

    Parameters

    Returns void

Properties

facetSearch: FacetSearch

Provides methods to search the facet's values.

state: FacetState

The state of the Facet controller.