

The best time to create a suggester is when you're also defining the field that will use it. A suggester takes a name and a collection of fields over which the typeahead experience is enabled. To create a suggester, add one to an index definition. Both requests target the documents collection of specific index and responses are returned after a user has provided at least a three character input string. You can implement both typeahead behaviors within the same search solution if you want an experience similar to the one indicated in the screenshot. Search-as-you-type support is enabled on a per-field basis for string fields. The remainder of this article is focused on creating a suggester.Ĭall a suggester-enabled query, in the form of a Suggestion request or Autocomplete request, using one of the APIs listed below. To implement these behaviors in Azure Cognitive Search, there's an index and query component.Īdd a suggester to a search index definition. You can use these features separately or together. For suggestions, you can surface any field that provides descriptive information. Suggestions are mini search results, where a field like hotel name represents a matching hotel search document from the index.

Autocomplete anticipates a potential term, finishing "tw" with "in". The following screenshot from Create your first app in C# illustrates both. Typeahead can be autocomplete, which completes a partial input for a whole term query, or suggestions that invite click through to a particular match. Typeahead experiences in Cognitive Search The same suggester supports both experiences.

Matches on partial terms can be either an autocompleted query or a suggested match. For example, a suggester that includes a City field with a value for "Seattle" will have prefix combinations of "sea", "seat", "seatt", and "seattl" to support typeahead. A suggester provides a list of fields that undergo extra tokenization, generating prefix sequences to support matches on partial terms. In Azure Cognitive Search, typeahead or "search-as-you-type" is enabled through a suggester.
