Skip to content

How to Implement Autocorrect with Facet Selection in Elevate

Overview

When a visitor performs a search containing a misspelling, Elevate's autocorrection feature may return results for the corrected term. The autocorrection feature is exposed via the search page endpoint/method. However, if the visitor then applies a facet filter, the autocorrection is no longer applied automatically. To ensure consistent and relevant results, the q parameter in subsequent requests must use the corrected phrase returned from the initial search.

Problem Description

  • Scenario: User searches with a typo → Elevate autocorrects and returns relevant results → User selects a facet filter.
  • Issue: If the next request still uses the misspelled term in the q parameter, autocorrection will not be applied and may yield to no hits, or yield hits based on the misspelled results which may confuse the site visitors.
  • Solution: Use the corrected phrase from the initial search response in all follow-up queries with facets.

Step-by-Step Implementation

Step 1. Initial Search Request with Misspelling.

The visitor searches with a misspelled term for example “jakcet”, and the following query is sent to Elevate: /storefront/v3/queries/search-page?customerKey=TEST&sessionKey=TEST&touchpoint=DESKTOP&locale=sv-SE&market=SE&q=jakcet

Step 2. Capture the Corrected Phrase.

The response will include: - Search results based on the autocorrected term. - The corrected phrase itself (e.g., "jacket"), below is a snippet of Elevate’s response:

{
   "q": "jakcet",
   "autoCorrect": {
     "q": "jacket",
     "originalTotalHits": 0
 }
}

Step 3. Send Corrected Phrase When Applying Facets.

When the visitor applies a facet (e.g., color=BLUE), send the corrected phrase in the q parameter instead of the original misspelling: /storefront/v3/queries/search-page?customerKey=TEST&sessionKey=TEST&touchpoint=DESKTOP&locale=sv-SE&market=SE&q=jacket&f.color=BLUE

Summary

To maintain search accuracy after a misspelled query followed by a facet selection:

  1. Accept the misspelled input in the first request.
  2. Present a visual cue that the phrase has been autocorrected, such as a text that says “Your search for jakcet did not match any products, corrected to jacket” and present the search results based on the autocorrected phrase. If the original phrase has originTotalHits > 0, you can provide a link to the original misspelled phrase, and use the parameter origin=UNDO_AUTO_CORRECT.
  3. If a visitor selects a facet, use the corrected phrase in all follow-up requests with facets.
×
Copyright

This online publication is intellectual property of Voyado Lund AB. Its contents can be duplicated in part or whole, provided that a copyright label is visibly located on each copy and the copy is used in conjunction with the product described within this document.

All information found in these documents has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither Voyado Lund AB nor the authors shall be held liable for possible errors or the consequences thereof.

Software and hardware descriptions cited in these documents might be registered trademarks. All trade names are subject to copyright restrictions and may be registered trademarks. Voyado Lund AB essentially adheres to the manufacturer’s spelling. Names of products and trademarks appearing in this document, with or without specific notation, are likewise subject to trademark and trade protection laws and may thus fall under copyright restrictions.

CLOSE