Autocomplete allows users to quickly complete search queries by providing suggestions as users type. Once a user starts entering their query, they can see autocomplete suggestions appear below the search box and can easily select them to complete their query.
Autocomplete is especially useful to users who are searching on mobile devices or who need extra assistance when typing such as fixing spelling.
Autocomplete suggestions also enable you to show your users popular or trending searches since query suggestions are returned in order of popularity.
In this section we will explain how autocomplete works out-of-the-box and how you can customize it.
Querying using Autocomplete
Search.io builds a custom autocomplete model from the records in your collection and queries that users type into your search box. As a user types a query, the autocomplete model returns a list of phrases that begin with the text typed by the user. Autocomplete suggestions are returned in order of popularity, from most popular to least popular.
Autocomplete also corrects spelling so suggestions will still be returned if a user types a misspelled word.
A typical search using autocomplete consists of two modes:
Autocomplete mode - Active as a user is typing into the search box. Autocomplete suggestions are returned as the user types. This uses a query pipeline dedicated to Autocomplete which returns suggestions not search results
Query mode - Active when a user triggers a search by pressing the return key, clicking a suggestion or clicking the search button. A search is performed and results are returned. This uses the standard query pipeline dedicated to returning search results