@coveo/headless-react
    Preparing search index...

    Interface DidYouMean

    The DidYouMean controller is responsible for handling query corrections.

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

    Hierarchy (View Summary)

    Index

    A scoped and simplified part of the headless state that is relevant to the DidYouMean controller.

    • Executes a search using the suggested query correction.

      Typically, you only call this method when state.hasQueryCorrection is true and state.wasAutomaticallyCorrected is false. When this is the case, you could call this method when the user clicks a link to search with the suggested query correction rather than with the query they originally submitted.

      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.