Fuzzy Search Support

Detailed explanation of Fuzzy Search

The Auto-suggest API includes an optional 'fuzzy' parameter, a boolean value, in its GET request. This parameter enables the implementation of fuzzy search when set to 'true', 'yes', or 1. Fuzzy search facilitates the discovery of approximate matches based on the Levenshtein edit distance. Essentially, the Levenshtein distance denotes the number of insertions, deletions, substitutions, and transpositions required to equalize two strings. For instance, the Levenshtein distance between "ax" and “axe” is 1, reflecting a single deletion necessity.

In the absence of fuzzy search, a query like 'amster' using the Auto-suggest API would return matches like Amsterdam - as the default match phrase algorithm is at play. But when fuzzy search is enabled, you'll receive responses such as 'Amstel'. This results because 'Amstel', as compared to Amsterdam, needs fewer modifications to match 'amster'. Specifically, 'Amstel' only requires replacing 'l' with 'r', whereas Amsterdam requires three character deletions. Therefore, with fuzzy search, 'Amstel' ranks higher than 'Amsterdam' considering it requires fewer alterations to match the query 'amster'.

Last updated