Overview

Often users incorrectly spell words, or use words that may not appear in the product indexed data, but have a similar meaning.

In these cases it can be helpful to provide users with alternate suggestions to the search query they have entered in an attempt to give them more meaningful search results.

This is achieved by way of a "Did you mean?" suggestion.


Sources of "Did you mean" suggestions

There are two sources of alternatives for "did you mean" suggestions.

The first is the Query Translation table, where the site administrator can setup common search terms and alternates. When a query translation is setup with "auto correct" flag unticked, it will be used as a "did you mean" suggestion.

The second source is Lucene's spelling index. When you configure index fields in the search database, you can specify which fields make up the Spelling Index. This data can then be used on a word-by-word bases to test for suggested alternates.

Query Suggestion Process

The process for providing a "did you mean" suggestion is as follows:

  • Check if the entire search phrase exists in the Query Translation table. If so, use the translated value
  • If the entire search phrase does not exist, the search phrase is broken into words. For each word:
    • Check if the word exists in the Query Translation table. If so, replace the search term word with the translated word.
    • If the word did not exist in the Query Translation table, ask Lucene to suggest similar words.
    • If similar word suggestions exist, the most similar word will replace the search query word only if it is a more frequent word (i.e. it appears more commonly in the product data than the search term word)
    • If the previous 2 steps did not result in a word replacement, the original search term word is retained.

Further, if Lucene spelling corrections are used for any word replacements, the resulting suggestion is only used if the search result of the suggested search term will produce more results than the original search term.

The additional checks around Lucene spelling replacements are designed to reduce "false suggestions" that might arise.

User Interface

When a search results is a "did you mean" suggestion being available, it can be displayed using the [TemplateUtil.ProductSearchQuery_DidYouMean] token. When there is no suggestion this token renders no output.

The output of the token can be modified by changing the resource value of resource rcDidYouMean. The default value is:


Did you mean "<a href='ProductDisplay.aspx?ProductSearch={0}&dym=true'>{0}</a>"?


This default value displays: Did you mean "XXX"?, with the suggested term as a clickable link that will perform the search for the suggested term.

Note that "dym=true" is passed as a querystring to the search page. This prevents further "Did you mean" suggestions from appearing.


Related help