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. This feature also provides suggestions for properly spelled keywords when a similar term with more results is available.

Auto corrected query example

This article provides a high-level feature overview, lists the feature limitations, and explains how to Configure the feature.

About the feature

When a queried term isn’t, or is rarely, present in indexed items, 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 no results, the keywords are automatically replaced with the most frequently occurring terms with the closest spelling and a new query is triggered.


    This is the default behavior, but you can disable auto correction so that the Query Correction feature doesn’t automatically replace the keywords and trigger a new query when no results are returned. Instead, the feature would provide a link suggesting similar frequently occurring terms.

  • If the current query returns a few 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.


An end user is trying to find a specific movie (Ex Machina) on your theater’s search page, and sends a query with the misspelled keywords Ex Manchia:

  • If the query returns no results, the Query Correction feature automatically corrects the keywords to Ex Machina, since Ex Machina is similar and occurs frequently in the index, and triggers a new query using the new keywords.

    Query correct replace
  • If the query returns a few results, the Query Correction feature displays the results but suggests the keywords Ex Machina to the end user as it appears more frequently in the index.

    Query correct suggest

When searching for a person’s name, such as for a colleague in an intranet search, Query Correction typically provides good results when the indexed name is one letter away from the query keyword.


You perform a search on the name Alex. Given Query Correction’s default functionality, typically:

  • If the query returns no results, the Query Correction feature automatically corrects the query to Alexi if the index contains frequent occurrences of Alexi and triggers a new query using the new keywords.

  • If the query returns just a few results for Alex, but the index contains more occurrences of Alexi, the Query Correction feature suggests Alexi to the end user without replacing or triggering a new query.

  • Coveo wouldn’t suggest or correct the query to Alexandra as the names are more than one letter away.

However, for an optimal people search experience, you should use a combination of Thesaurus rules and Advanced Field Queries (wildcard, fuzzy, or phonetic search).


  • 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 feature ignores query keywords that:

    • Are less than four characters long.

    • Contain more than four digits.

    • Begin with a digit.

    • 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.

Configure the feature

The Query Correction feature is enabled by default in a JavaScript Search Framework search interface.


If your search interface is built using a platform other than JavaScript Search Framework, see the appropriate article for information on how to configure the feature:

The feature is initialized using the DidYouMean component. Visually, this component is intended to appear in the results column, above the result list.

To modify the feature, access the Code View of the Classic Interface Editor for your search interface.

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