Query Correction Feature

Coveo supports a query correction feature, also known as Did You Mean, which can suggest substitutes for, or even automatically correct misspelled keywords.

Auto corrected query example

This article explains how to enable this feature in your search interfaces, and provides a high-level overview of the way it works.

Enabling the Feature

In a JavaScript Search Framework interface, you can enable the query correction feature by initializing a DidYouMean component.

Visually, this component is intended to appear in the results column, above the result list. Most sample search interfaces include this component by default.

<div id="search" class="CoveoSearchInterface">
  <!-- ... -->
  <div class="coveo-main-section">
    <!-- ... -->
    <div class="coveo-results-column">
      <!-- ... -->
      <div class="CoveoDidYouMean"></div>
      <!-- ... -->
      <div class="CoveoResultList"></div>
      <!-- ... -->
  <!-- ... -->

By default, the component automatically triggers a new query when no results are returned and a query correction is available. If you want to disable this behavior, set the component’s enableAutoCorrection option to false.

<div class="CoveoDidYouMean" data-enable-auto-correction="false"></div>

About the Feature

When a queried term isn’t (or rarely) present in indexed items, by default Coveo looks for any terms with a similar spelling and a significantly higher number of occurrences in your index. When terms that match these conditions are found, the following actions occur:

  • If the current query returns results but more frequently occurring terms with similar spelling are found in the index, a link containing the new terms is provided. Selecting this link triggers a new query using the corrected keywords.

  • If the current query returns no results, and the DidYouMean component’s enableAutoCorrection option isn’t explicitly set to false, the keywords are automatically replaced by the most frequently occurring terms with the closest spelling and a new query is triggered.

  • An end user is trying to find a specific movie on your theater’s search page. The end user sends a query with the keywords Ex Mcanhia, which returns no results. The DidYouMean feature automatically corrects the keywords to Ex Machina and triggers a new query using the new keywords.

  • An end user is trying to find a specific movie on your theater’s search page. The end user sends a query with the keywords Ex Machnia, which returns a few results. The DidYouMean feature suggests that the end user instead uses the keywords Ex Machina.


  • The index must have at least 2,000 items to start providing query corrections.


    The relevance of the corrections improves with the size of the index, as more correctly-spelled terms become available for comparison.

  • The Did You Mean feature ignores query keywords that:

    • Are less than four characters long.

    • Contain more than four digits.

    • Begin with a digits.

    • Contain seven or more consecutive consonants.

    • Contain six or more consecutive vowels.

    • Contain an invalid number of consecutive vowels, considering the item language.

    • Contain wildcard expressions.

    • Were expanded by a thesaurus rule.


Generally, the Did You Mean feature doesn’t correct queries that were processed by a Coveo Machine Learning (Coveo ML) Automatic Relevance Tuning (ART) model for which the Intelligent Term Detection (ITD) feature is enabled. However, note that in rare cases, the Did You Mean feature may process these queries.

What's next for me?