Create typo correction using a suggestions block
To create typo correction functionality, use suggestions blocks. In particular, employ the edit distance algorithm in the suggestions block to assist in correcting typos or near-miss keywords. This displays keywords closely resembling the visitor's input in the preview search widget.
-
Enable the keywords attribute for use with suggestion blocks.
To create typo correction using a suggestions block:
-
On the menu bar, click Administration > Domain Settings > Feature Configuration.
-
Click the Suggestions Blocks card, then scroll to the bottom of the page and click
Add Suggestion Option.A new suggestions block appears at the bottom of the page with placeholder text in the Display name and Suggestion name fields.
-
In the Display name field, delete the placeholder text and enter a descriptive name such as Keyword typo.
Then, click the Suggestion name field, delete the placeholder text and enter a lowercase version of the name with no spaces, such as keyword_typo.
-
In the Algorithm field, click Edit distance.
-
In the Analyzers field, click Add Analyzer and select Shingle Generator. Then, click Add Analyzer again and select Lowercase.
-
Click the Build Suggestions From field and, in the drop-down menu, click Keywords.
-
In the Grouping Analyzer field, click Shingle Generator. Then, in the Match Analyzer field, click Lowercase.
-
Click Save, then click Publish. This opens a dialog box. Confirm your changes by clicking Publish again in the dialog box.
ImportantIn the dialog, leave the Reindex all sources after publishing domain settings check box selected. Reindexing is necessary for the new suggestions block to be available for use.