Autocomplete query is designed to manage typeahead search. It will return based on partial matches of a word.
Autocomplete supports the same filtering, faceting, sorting, and pagination as the browse and search queries. Unlike search, it matches the partial input typed by a shopper against the item name only.
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.
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.
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.
| Option | Type | Default | Description |
|---|---|---|---|
fuzziness | Fuziness (NONE, SINGLE, DOUBLE) | NONE | Maximum 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. |
prefixLength | Int | 0 | Number of characters at the start of each term that must match exactly before any fuzzy edits are applied. |
maxExpensions | Int | 50 | Maximum number of term variations to generate and search for. |