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
- A user enters a search phrase into the Storefront.
- Fewer results than the minimum configured value are found when performing both exact and fuzzy searches.
- SearchService analyzes the original search request supplied by the user and delegates to the SolrIndexSearchService.
- SolrIndexSearchService delegates to SolrSpellIndexSearcherImpl.
- SolrSpellIndexSearcherImpl generates possible suggestions for each term based on words that already exist in the product index.
- SearchService starts a new search using the generated suggestions.
- SearchService checks the generated suggestions to make sure that they would return more than the minimum configured value
- SearchService presents the results the user as alternate queries.
To configure Search Suggestions, see the Search Settings page.