Search code examples
azuresearchazure-cognitive-search

How to disable tokenization for Azure Search Autocomplete?


I've created Azure Search Suggester for "full_name" index field in order to support autocomplete functionality. Now when I use Azure autocomplete REST endpoint by using "search" parameter as a let's say "Lor" I only get back the result "Lorem" not the "Lorem Ipsum". Is there any way to disable tokenization for suggester and to get back full name like "Lorem Ipsum" for the search term "Lor" for autocomplete?


Solution

  • The Autocomplete API is meant to suggest search terms based on incomplete terms one is typing into to the search box (type-ahead). It supports three modes:

    oneTerm – Only one term is suggested. If the query has two terms, only the last term is completed. For example:

    "washington medic" -> "medicaid", "medicare", "medicine"

    twoTerms – Matching two-term phrases in the index will be suggested, for example:

    "medic" -> "medicare coverage", "medical assistant"

    oneTermWithContext – Completes the last term in a query with two or more terms, where the last two terms are a phrase that exists in the index, for example:

    "washington medic" -> "washington medicaid", "washington medical"

    The twoTerms mode might work for you. If you're looking for an API that suggests documents based on an incomplete query term, try the Suggestions API. It returns the entire contents of a field that has a Suggester enabled for all documents that matched the query.