Skip to content
uencoder

Fuzzy Search

Fuzzy search is a search technique tolerant of spelling variations, matching approximate results based on edit distance, n-grams, or phonetic algorithms.

Purpose

Returns relevant results even when user input contains typos or variants, improving the search experience.

Mechanism

Common methods: Levenshtein distance threshold matching, n-gram inverted indexes, BK-tree acceleration, Soundex/Metaphone phonetic matching, and the Bitap algorithm. Implementations are provided by fuse.js, the Elasticsearch fuzzy query, and others.

Use cases

  • Search engine spelling correction
  • Command-line autocompletion
  • Database fuzzy queries
  • Code search (typo-tolerant)

Examples

  • Input
    recieve → receive
    Output
    Matches receive (distance 2)

    Spelling correction

Common errors

Overly loose thresholds cause too many false matches
Adjust thresholds dynamically based on word length

Related terms

References