Relax search queries without ruining precision

Start with strict Boolean matching, then relax terms in controlled tiers to avoid empty results while protecting top-rank relevance.

Boolean Tiered Search

Boolean tiered search starts strict and relaxes only when needed. It is a practical way to preserve precision at the top while avoiding empty pages.

Why Pure AND/OR Fails

Strategy Behavior Problem --- --- --- AND all terms High precision Typos and missing vocabulary produce no results OR all terms High recall Common terms flood the result set Tiered Strict first, loose later More query planning and deduping

The tier becomes a ranking feature: all-term matches outrank partial matches before secondary scoring.

Fetch posting list. Intersect for strict tiers. Union for relaxed tiers. Deduplicate documents already seen in higher tiers. Score within each tier using BM25/boosts/signals.

Tiers should map to user-visible promises. A product search page may treat exact title phrase matches as tier 0, all required terms as tier 1, most terms as tier 2, and synonym or fuzzy matches as tier 3. A legal search system may refuse low-confidence tiers by default because recall mistakes are less harmful than precision mistakes.

Tier Example Rule Use When --- --- --- Exact phrase "iron man" in title Navigational queries and known titles. All terms iron AND man Good default for short queries. Minimum match any 3 of 4 terms Long descriptive queries. Synonym/fuzzy tv - television Rescue weak result sets.

Stop expanding when enough high-quality candidates exist. A common policy is to target 5x to 20x the requested page size for final ranking. Expanding every query to every tier increases latency and lets weak matches compete unnecessarily.

Term presence is not enough. A document where iron and man are adjacent should outrank one where the words appear pages apart. This requires positional postings.

exact phrase match, term window size, ordered vs unordered match, field-specific proximity, such as title phrase body phrase.

Loose tiers can bury exact matches if tier is not a strong ranking feature. Synonym expansion can change intent, such as apple the fruit vs the company. Fuzzy matching can explode candidate count for short tokens. Deduping by document ID is not enough when variants share canonical content. Pagination can look unstable if later tiers are fetched lazily without a fixed cursor.

Log which tier produced each result and which tier produced the clicked result. If most clicks come from relaxed tiers, the strict analyzer may be too brittle. If users reformulate after relaxed results, the fallback may be too aggressive.

Expose a debug view that shows generated clauses, per-tier counts, and final rank features. This lets engineers explain why wireless mouse pad matched mouse products, pad accessories, or both.

Do not treat empty results as neutral. Empty results are often a synonym, typo, segmentation, inventory, or indexing problem. Log them aggressively.

wiki/inverted-index-and-posting-lists wiki/query-understanding-pipeline wiki/search-feedback-and-relevance-signals