Discovery autocomplete queries

Autocomplete query is designed to manage typeahead search. It will return based on partial matches of a word.

How matching works

The autocomplete query is built for typeahead: it returns suggestions whose name matches a sequence of characters from an incomplete input string. As the shopper types, send the current input as term and present the returned hits as suggestions.

note

Autocomplete only matches the name field

Partial (prefix/typeahead) matching applies exclusively to the item name field — it cannot be pointed at other fields. To match against additional fields or run full-text relevance scoring, use the search query instead.

Fuzzy options

Autocomplete accepts the same fuzzy options as search, supplied through options.fuzzy. Fuzzy matching tolerates small typos in the input by allowing a limited number of single-character edits. It only takes effect when fuzziness is set to SINGLE or DOUBLE; with NONE (the default) matching is exact.

OptionTypeDefaultDescription
fuzzinessFuziness (NONE, SINGLE, DOUBLE)NONEMaximum number of single-character edits (insert, delete, or substitute) allowed when matching a term. SINGLE allows 1 edit, DOUBLE allows 2, and NONE disables fuzzy matching.
prefixLengthInt0Number of characters at the start of each term that must match exactly before any fuzzy edits are applied.
maxExpensionsInt50Maximum number of term variations to generate and search for.