Spring over navigation

Autocomplete in Azure Search now in public preview

Udgivet den 28 juni, 2018

Software Developer II, Azure Search

Today, we are happy to announce public preview support for autocomplete in Azure Search, one of our most requested features on UserVoice. Autocomplete, also called “type-ahead search”, can enhance the search experience by finding potential terms in the index that match the partial term being written by the user. An example of similar functionality is shown below from bing.com:

 bing.com

Autocomplete modes

For autocomplete to work, the fields in the search index should be listed in a suggester. For example, if you define a suggester on a city field, typing "sea" will return terms like “Seattle” or “Seaside” if those terms exist in the city field.

The table below describes the 3 modes supported by Autocomplete and the expected results in each scenario.

Mode Behavior Query Autocompleted results
OneTerm Returns a single term which autocompletes the partial term of the query. “what a wo

“women”

“wool”

“world”

TwoTerms Returns a single term and two terms which autocomplete the partial term of the query. “what a wo

“wonderful day”

“wolf spider”

“woman”

“world”

OneTermWithContext Returns two terms such that the last two terms from the input query appear together. “what a wonderful d

“wonderful day”

“wonderful dog”

Autocomplete API also supports fuzzy matching in each of these modes. When fuzzy is enabled, it compensates for typos and misspellings, and proposes relevant results based on user intent. For more details about these options, please refer the API documentation.

Suggest vs. Autocomplete

For those of you already familiar with Azure Search, you might be wondering how Autocomplete compares to the existing Suggestions feature. Given a partial query term, Suggestions API suggests documents and returns document Ids which contain the query term, while the Autocomplete API returns potential terms from the index which match the partial term in the query. The following examples illustrate the same:

Suggested results

Suggest

Autocompleted results

Autocomplete

Next steps

  • Try out these new enhancements using the tutorial.
  • Learn more by visiting documentation for SDK and API.

Please note that the API is available in the 2017-11-11-Preview version. If you have already defined a suggester on some fields in your index, you can start experimenting with this API right away. For everybody else, you'll need to add fields and bind them to a new suggester, or create a new index with fields included in a suggester. You can't add a suggester that includes fields without recreating your index.

If you are already using Suggest from Azure Search, please give this a try. We’d love to hear your feedback!