The DidYouMean controller is responsible for handling query corrections.

Example: did-you-mean.fn.tsx

interface DidYouMean {
    state: DidYouMeanState;
    applyCorrection(): void;
    subscribe(listener: () => void): Unsubscribe;
    updateQueryCorrectionMode(queryCorrectionMode: QueryCorrectionMode): void;
}

Hierarchy (View Summary)

Methods

  • Apply query correction using the query correction, if any, currently present in the state.

    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.

  • Update which query correction system to use

    legacy: Query correction is powered by the legacy index system. This system relies on an algorithm using solely the index content to compute the suggested terms. next: Query correction is powered by a machine learning system, requiring a valid query suggestion model configured in your Coveo environment to function properly. This system relies on machine learning algorithms to compute the suggested terms.

    Parameters

    • queryCorrectionMode: QueryCorrectionMode

      the query correction mode to use

    Returns void

Properties

The state of the DidYouMean controller.