Suggestions
As of Dynamicweb 9.8 the Indexing engine supports ‘Did You Mean’-suggestions – this helps users find what they are looking for even if they make a minor spelling mistake or are not certain how a search term is spelled (Figure 1.1).
At the technical level, we apply the Lucene SpellChecker against an index document field and – based on the available terms in that field for all documents – find the closest matches using several distance filters.
Implementing “Did you mean”-suggestions is very easy – let’s say you have a free-text search on a website where users search in the following fields:
- Product name
- Product number
- Variant options
- Short description
- Long description
For simplicity’s sake these fields have been added to a Summary-field called FreeText – and you want to provide suggestions to a user whenever they search for a term which can’t be found in the index.
- Open the product catalog app used to publish your products
- Find the Spell Check section and configure it (Figure 1.2):
- Field to check: FreeText
- Query parameter: Search – or whatever your free-text search parameter is called
- In the Templates section create or edit the No product found template and render suggestions – see code below for an example: