Typo Tolerance and Tokenisation: How Site Search Reads a Query Before It Ranks Anything
Before ranking starts, search has to parse the query. Tokenisation, stemming, and typo tolerance decide whether the right products are candidates at all.
Site search first breaks a query into tokens, normalises them with stemming and synonym mapping, and applies typo tolerance, usually allowing one or two edit distance errors depending on word length. Only then does ranking order the candidates. Most bad search results are parsing failures, not ranking failures: a two word product name tokenised wrongly, a unit like 500ml split from its number, or a typo threshold so loose that a short word matches half the catalogue. Shopify Search and Discovery and Baymard guidance both treat query understanding as the foundation the ranking sits on.
The parser decides what ranking never sees
Ranking can only order candidates the parser admitted. A query for running shoes size 11 that tokenises the size as a separate product attribute works. The same query parsed as a model number search returns a baffling list, and no ranking signal can rescue products that were never retrieved. Stores debug the ranking for months while the failure sits one step earlier, in how the words were read.
Test the parser directly with your top 100 real queries and read the candidate logic, not just the final list. The zero results piece covers the empty end of parsing failure; partial failure is sneakier, because the list is full, plausible, and missing the one product the shopper came for.
Typo tolerance is a dial with two failure ends
Edit distance is the standard measure: one wrong letter in a long word is a typo, while short words need tighter handling because a one letter change in a three letter word is often a different word entirely. Set tolerance by word length, none or minimal for very short tokens, one edit for medium, two for long. Too tight and misspelled brand names return nothing. Too loose and the results fill with near matches that bury the exact one.
Watch the correction that changes meaning. A shopper typing a competitor style term or a specific model code may be corrected into your nearest product and served confidence instead of accuracy. The facet ordering piece deals with narrowing after retrieval; typo handling decides what there is to narrow, and an overcorrected query narrows confidently around the wrong products.
Units, codes, and compounds are the edge cases that matter
Real catalogues are full of tokens parsers mangle: capacities joined to units, hyphenated ranges, model codes mixing letters and digits, and compound words shoppers split differently than the catalogue does. Each pattern needs an explicit rule, tested against real queries: keep number and unit together, index hyphenated terms both joined and split, and never stem a model code into a word.
Keep a regression list. Every parsing failure found in support tickets or search logs becomes a permanent test query, run after every search configuration change. Search tuning drifts silently, a synonym added for one campaign breaks another query's parsing, and the regression list is the only memory the system has.
Frequently asked questions
What is tokenisation in site search?
Breaking a query into individual terms and normalising them, handling units, hyphens, plurals, and codes, so the search engine can match them against the catalogue. Parsing errors at this stage exclude the right products before ranking ever runs.
How much typo tolerance should search allow?
Scale it by word length: little or none for very short words, one edit for medium words, up to two for long words. Uniform tolerance either misses real misspellings of long names or floods results with false matches on short terms.
Why does search return full but wrong results for some queries?
Usually a parsing problem: a size or unit tokenised as a model code, an overaggressive typo correction, or a compound term split differently than the catalogue spells it. The list looks healthy while the intended product was never retrieved as a candidate.
How should a store test its search parser?
Maintain a regression set of real queries, including every failure found in logs and support tickets, and run it after any search configuration change. Parsing regressions are silent, so the test list is the only reliable memory of past failures.