Tuning Algolia Typo Tolerance for Precise Search Results
A practical guide to adjusting Algolia's typo tolerance settings, disabling fuzzy matching on SKUs, and verifying changes with real queries.
13 Aug 2025, 10:14 UTC

The problem: noisy results on exact identifiers
Imagine a product catalog where users search by SKU, model number, or year. With Algolia’s default typo tolerance, a query like ABCD1234 also matches ABCD1235 because the engine treats the trailing digit as a one‑character edit. The result set suddenly contains unrelated items, click‑through drops, and the search feels “broken.”
The fix isn’t to turn typo tolerance off globally — that would hurt the normal fuzzy experience for free‑text queries. Instead, you can scope the behavior: keep fuzzy matching for titles and descriptions, but require exact matches on identifier fields and numeric tokens.
How Algolia applies typos and prefixes by default
- Typo tolerance uses a Levenshtein‑distance algorithm. One typo is allowed for words ≥ 4 characters; two typos for words ≥ 8 characters. Thresholds are controlled by
minWordSizefor1TypoandminWordSizefor2Typos. - Prefix matching is always active on the last query token (type‑as‑you‑go). Earlier tokens must match exactly or via typo tolerance.
- Ranking places the
typocriterion afterwords,filters, and beforeproximity, so exact matches outrank 1‑typo matches, which outrank 2‑typo matches.
Key configurable parameters
| Parameter | Scope | Effect |
|---|---|---|
minWordSizefor1Typo | Index setting | Minimum word length before a single typo is considered (default 4). |
minWordSizefor2Typos | Index setting | Minimum word length before two typos are allowed (default 8). |
disableTypoToleranceOnAttributes | Index setting (array of attribute names) | Turns off typo tolerance for the listed attributes only. |
disableTypoToleranceOnWords | Index setting (array of words) | Prevents typo expansion for specific tokens such as brand names. |
allowTyposOnNumericTokens | Index setting (boolean) | When false, numeric tokens (SKUs, years, model numbers) are matched exactly. |
Worked example: protecting a SKU field
Assume an index products with records containing title, description, and sku. We want fuzzy matching on title and description but exact matching on sku and any numeric token.
curl -X PUT "https://YOUR_APP_ID.algolia.net/1/indexes/products/settings" \
-H "X-Algolia-API-Key: YOUR_ADMIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{\n \"minWordSizefor1Typo\": 4,\n \"minWordSizefor2Typos\": 8,\n \"disableTypoToleranceOnAttributes\": [\"sku\"],\n \"allowTyposOnNumericTokens\": false\n}'
Where to run: any terminal with network access to Algolia’s API. Permissions: an API key with settings ACL (admin key or a dedicated key). Placeholders: replace YOUR_APP_ID, YOUR_ADMIN_API_KEY, and products with your actual values.
Expected check: after the call, query the index with a one‑character SKU typo:
curl -X POST "https://YOUR_APP_ID.algolia.net/1/indexes/products/query" \
-H "X-Algolia-API-Key: YOUR_SEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{\"query\": \"ABCD1235\"}'
Inspect the response’s _rankingInfo.typo field for the record that contains sku: \"ABCD1234\". It should be absent (or have typo: 0 only if the match came from another attribute). If the record still appears with typo: 1, the attribute‑level disable did not take effect — some plans require a re‑index for the disableTypoToleranceOnAttributes setting.
Trade‑offs and verification
- Noise vs. recall: Lowering
minWordSizefor1Typoto 1 lets the engine correct typos on very short words (e.g., “a” → “i”), but it floods results on short queries. Keep the default or raise it for cleaner results. - Re‑index requirement: Changing
disableTypoToleranceOnAttributesordisableTypoToleranceOnWordsmay need a full re‑index on certain pricing tiers. Verify in your dashboard’s “Indices → Settings → Advanced” whether the setting shows “live” or “requires reindex”. - Interaction with synonyms and rules: A synonym expanded from a typo‑corrected term can cascade into unexpected matches. Test combined behavior in a staging index before promoting to production.
- Monitoring: Export query logs via the Analytics API (or the dashboard) and look at the
typocount per query. High typo counts paired with low click‑through signal that the current thresholds are too permissive for that query pattern.
Actionable next steps
- Identify every attribute that must match exactly (SKU, model, year, ISBN, etc.).
- Add those attribute names to
disableTypoToleranceOnAttributesand setallowTyposOnNumericTokenstofalse. - If you see many one‑character typos on short words, raise
minWordSizefor1Typoto 5 or 6. - Run the verification queries shown above; confirm the
typofield behaves as expected. - Schedule a weekly review of the Analytics typo‑rate report to catch regressions early.
By scoping typo tolerance to the fields that truly benefit from fuzziness, you keep the fast, forgiving experience for natural‑language searches while guaranteeing precision on the identifiers that drive purchases and support lookups.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.