How Meilisearch handles typos
Meilisearch uses a typo tolerance system based on Damerau-Levenshtein edit distance. An edit distance counts the minimum number of single-character operations (insertions, deletions, substitutions, or transpositions) needed to transform one word into another. For example, “galaxy” and “galxy” have an edit distance of 1 (one deletion), while “galaxy” and “gelxay” have an edit distance of 2.Automatic word-length thresholds
Meilisearch applies typo tolerance automatically based on word length:| Word length | Allowed typos |
|---|---|
| 1-4 characters | 0 typos |
| 5-8 characters | 1 typo |
| 9+ characters | 2 typos |
Key characteristics
- Enabled by default: No setup required. Typo tolerance works out of the box on every index.
- Per-word-length tuning: The number of allowed typos scales with word length, reducing false positives on short words.
- Maximum of 2 typos: Meilisearch allows at most 2 typos per word, regardless of word length. This keeps results relevant without returning too many unrelated matches.
- Ranking integration: Documents with fewer typos rank higher than documents with more typos, thanks to the built-in
typoranking rule. - Disabling per attribute or word: You can disable typo tolerance on specific attributes or for specific words using the typo tolerance settings API.
How fuzzy search works in other engines
Fuzzy search is a broader term that covers several techniques for approximate string matching. In engines like Elasticsearch, fuzzy search typically uses edit distance as well, but requires explicit configuration.Common fuzzy search approaches
- Edit distance with manual fuzziness: Elasticsearch’s
fuzzinessparameter lets you set the maximum edit distance per query or field. You can useAUTOmode, which applies length-based thresholds similar to Meilisearch, but this must be opted into explicitly. - N-gram based matching: Some engines break words into overlapping character sequences (n-grams) and match documents that share enough n-grams with the query. This can catch typos but also produces more false positives.
- Phonetic matching: Algorithms like Soundex or Metaphone match words that sound similar, regardless of spelling. This helps with phonetic misspellings but does not handle transpositions or insertions well.
Key characteristics
- Opt-in configuration: Fuzzy search is typically disabled by default and must be enabled per field or per query.
- Manual tuning required: You choose the fuzziness level, decide which fields support fuzzy matching, and configure analyzers or tokenizers accordingly.
- Flexible but complex: Engines like Elasticsearch offer fine-grained control over fuzziness, prefix length, max expansions, and transposition handling, but this flexibility comes with a steeper learning curve.
Side-by-side comparison
| Meilisearch (typo tolerance) | Typical fuzzy search | |
|---|---|---|
| Enabled by default | Yes | No (opt-in) |
| Configuration required | None for basic use | Fuzziness level, fields, analyzers |
| Algorithm | Damerau-Levenshtein | Varies (edit distance, n-grams, phonetic) |
| Max typos | 2 | Configurable (often 0-2) |
| Word-length awareness | Built-in thresholds | Available in some engines (e.g., Elasticsearch AUTO) |
| Ranking impact | Fewer typos rank higher automatically | Depends on scoring configuration |
| Per-attribute control | Yes (disable on specific attributes) | Yes (configure per field) |
| Per-word control | Yes (disable for specific words) | Limited |
When each approach works best
Meilisearch typo tolerance
- You want typo handling that works immediately without configuration
- Your application targets end users who expect instant, forgiving search (e-commerce, media, SaaS)
- You prefer sensible defaults over manual tuning
Configurable fuzzy search
- You need granular control over fuzziness per field or per query
- Your use case requires matching strategies beyond edit distance (phonetic, n-gram)
- You have dedicated search engineers who can tune and maintain the configuration
Further reading
Typo tolerance settings
Configure typo tolerance thresholds and exceptions in Meilisearch
Ranking rules
Learn how the typo ranking rule affects result ordering
Meilisearch vs Elasticsearch
Full comparison between Meilisearch and Elasticsearch
Meilisearch vs Typesense
Full comparison between Meilisearch and Typesense