Create auto-complete functionality using suggestions blocks
You can create auto-complete functionality using suggestions blocks. Specifically, you can use the Context aware suggestions block algorithm to create auto-completion based on titles. This works by displaying content item titles that are close to the visitor's input in the Preview Search widget. This helps direct visitors to relevant content items before a search is performed.
-
Enable the title attribute for use with suggestions blocks, so that you can build suggestions using the titles of content items.
To create auto-complete functionality using a suggestions block:
-
On the menu bar, click Administration > Domain Setting > 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 fill in a descriptive name such as Title autocomplete.
Then, click the Suggestion name field, delete the placeholder text and fill in a lowercase version of the name with no spaces, such as title_autocomplete.
-
In the Algorithm field, click Context aware.
-
In the Analyzers field, click Add Analyzer and select Ngram Based Matching. Then, click Add Analyzer again and select Shingle Generator.
NoteIf your suggestion values are mostly single words, use the Keyword analyzer instead of the Shingle Generator.
-
Click the Build Suggestions From field and, in the drop-down menu, select Title.
-
In the Grouping Analyzer field, click Shingle Generator. Then, in the Match Analyzer field, click Ngram Based Matching.
-
Click Save, then click Publish. In the dialog that opens, confirm your changes by clicking Publish again.
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.