Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. The Developer Center continues to support Commerce 6.13.0 through 7.4.1.Visit new site

Search suggestions

Search suggestions

Search suggestions enable the user to select from one or more alternate search phrases if their original search phrase returned no results. The alternate search phrases attempt to correct any potential typos or misspellings that the original search phrase contains.

Key classes and files

  • SolrSpellIndexSearcherImpl - Parses a supplied query, and checks the spelling index to see if there are any suggestions for terms in that query.
  • SolrIndexSearchServiceImpl - A service for dispatching search requests to the SolrIndexSearcher.
  • ProductIndexBuilder - Creates a spelling index using the product index's content field.
  • SearchServiceImpl - A service for searching the product catalog.

How it works

  1. A user enters a search phrase into the Storefront.
  2. Fewer results than the minimum configured value are found when performing both exact and fuzzy searches.
  3. SearchService analyzes the original search request supplied by the user and delegates to the SolrIndexSearchService.
  4. SolrIndexSearchService delegates to SolrSpellIndexSearcherImpl.
  5. SolrSpellIndexSearcherImpl generates possible suggestions for each term based on words that already exist in the product index.
  6. SearchService starts a new search using the generated suggestions.
  7. SearchService checks the generated suggestions to make sure that they would return more than the minimum configured value
  8. SearchService presents the results the user as alternate queries.

Configuration

To configure Search Suggestions, see the Search Settings page.