Query Relaxation
Progressively loosening query constraints when a search returns too few (or zero) results, in order to surface something useful rather than failing the user entirely. A key recovery strategy for Zero Results pages.
The goal is to preserve as much user intent as possible while dropping or softening the constraints least likely to be load-bearing.
Relaxation Strategies
Term Dropping
Remove the rarest or least-important terms, keeping the core noun phrase last.
"blue vintage leather motorcycle jacket size XL"
→ "vintage leather motorcycle jacket"
→ "leather motorcycle jacket"
Heuristics for drop order: IDF (rare terms first), adjectives before nouns, modifiers before head noun.
AND → OR Conversion
Switch from requiring all terms (boolean AND) to any terms (boolean OR), relying on ranking to surface documents matching more terms at the top.
must(blue) must(leather) must(jacket)
→ should(blue) should(leather) must(jacket)
Minimum-should-match can be stepped down: 3 of 3 → 2 of 3 → 1 of 3.
Attribute / Facet Relaxation
For structured e-commerce queries, relax specific filter constraints in order of specificity:
- Size → any size
- Exact color (“navy blue”) → color family (“blue”) → any color
- Sub-brand → brand → category
Semantic Relaxation
Move up the taxonomy hierarchy to broaden scope:
"Nike Air Max 2024" → "Nike running shoes" → "running shoes"
Requires a product taxonomy or knowledge graph. Related to Semantic Search and Query Understanding.
Scope Expansion
Widen the catalog scope: scoped search (one department) → site-wide search → related catalog.
Implementation Patterns
Waterfall / Try-cascade Execute progressively relaxed queries until results appear. Most common pattern; adds latency (multiple round-trips).
query_1 = original
if hits == 0: query_2 = drop_one_term(query_1)
if hits == 0: query_3 = and_to_or(query_2)
...
Parallel execution Issue the relaxed query in parallel with the original, keep results in reserve. No latency cost; wasteful if original query succeeds often.
ML-predicted relaxation order Train a model on historical zero-result queries to predict which relaxation step will succeed. Skips unnecessary waterfall steps.
Token replacement (sibling of term dropping)
Instead of dropping a term, swap it for a sibling (Audi A1 → Audi A2) to stay specific. One approach masks the predicted position and fills it with a fine-tuned fill-mask model, then filters candidates by string similarity. Model-number swaps worked well, but other swaps drifted in meaning (Rene Kriegler & Jean Silva - Alternative Queries for Zero Results).
Offline evaluation data Pairs of a long zero-result query and a shorter sub-query with results, mined from query logs, each labelled with the index of the dropped term. Accuracy is scored against those labels. No public dataset is needed.
UX: Communicating Relaxation
Don’t silently substitute — users notice and lose trust.
- ✅ “No exact results. Showing results for leather motorcycle jacket”
- ✅ “We removed ‘size XL’ — showing all sizes. Filter to narrow down.”
- ❌ Silently returning unrelated popular items
- ❌ Showing empty page with no guidance
Key Tradeoffs
| Too conservative | Too aggressive |
|---|---|
| Empty result page | Irrelevant results |
| User abandons | User loses trust in relevance |
The right balance depends on query type: tail navigational queries need exact matches; broad exploratory queries tolerate more relaxation.
Judge relaxation by conversion, not just by the zero-results rate. At Rohlik, a first relaxation A/B test cut no-results searches to 1%, but relaxed queries converted at only 20% of the rate of normal ones; a better choice of terms to drop kept the 1% and lifted relaxed conversion to over 60% of normal (Query relaxation - the forgotten hero of eCommerce search). Dropping the rarest terms first can backfire: for spare parts and consumables the rare brand or model code is what decides fit, while for ordinary products the product type usually matters most. Showing dropped words as removable chips is another way to keep the shopper in control.
Relation to Query Rewriting
Query relaxation is one class of query rewriting — transformations applied before retrieval to improve result coverage. Other rewrites include synonym expansion, spelling correction, and query segmentation. Relaxation is specifically triggered by insufficient results rather than applied universally.
Related Concepts
-
Zero Results — primary trigger for relaxation
-
Query Understanding — relaxation is part of the rewriting phase
-
Faceted Search — attribute/facet relaxation
-
Spelling Correction — parallel zero-result recovery strategy
-
Synonyms — vocabulary-mismatch recovery (complement to relaxation)
-
Semantic Search — semantic relaxation via taxonomy/embeddings
-
Query Specificity — over-specific queries are the primary trigger for relaxation
Articles
- Query Understanding - Query Relaxation — Daniel Tunkelang; term dropping, AND→OR, attribute & semantic relaxation strategies
- Query relaxation - the forgotten hero of eCommerce search — Aron Negyesi; measure relaxed-query conversion, pick dropped terms by query type, show what was dropped
People
- Daniel Tunkelang — query relaxation as part of the Query Understanding series
- Rene Kriegler — reframes relaxation as query recommendation; ML term-drop prediction via Word2Vec + neural net
- Aron Negyesi — relaxation A/B tests at Rohlik; conversion of relaxed queries as the real metric
Videos
-
Rene Kriegler - Query Relaxation — Rene Kriegler; relaxation as a recommendation problem, with word-shape heuristics, term frequency, Word2Vec and a multi-layer neural network compared for predicting which term to drop
-
Rene Kriegler & Jean Silva - Alternative Queries for Zero Results — Rene Kriegler, Jean Silva (2023); the 2019 term-drop models revisited with fine-tuned language models (a RoBERTa drop-position classifier, a fill-mask model for token replacement), plus Wallapop’s simple least-frequent-term baseline built from search logs