Hybrid search and metadata filtering
Practice this questionOverview
- Hybrid search combines lexical and semantic candidate retrieval.
- Metadata filtering narrows records by explicit attributes such as tenant, policy version, date, or region.
- Filtering answers “which records are eligible,” while ranking answers “which eligible records are relevant.”
Why this matters
Meaning alone misses identifiers; keywords alone miss paraphrases. Unfiltered search can return another tenant's records or an outdated policy.
An everyday example
First enter the correct company's library, then search both the title index and subject shelves.
A technical example
Retrieve 30 BM25 and 30 vector matches within the authorized corpus, combine their ranks, then select 20 candidates.
How it works
- Derive trusted filters
- Retrieve both candidate sets
- Merge duplicates
- Combine ranks or calibrated scores
- Rerank if needed
- Return eligible evidence.
Architecture and flow
Query → BM25 + vector retrieval with ACL filters → fusion → candidate list.
The insurance assistant example
“What does exclusion EX-17 mean for water damage?” benefits from matching EX-17 exactly and water-damage meaning semantically.
When to use it
Mixed natural language and domain terminology, especially enterprise knowledge bases.
When to avoid it
Avoid adding two retrieval systems if measured results show no benefit. Never let the model choose tenant filters.
Interview answer
“Hybrid search combines keyword and vector retrieval; metadata filters enforce corpus eligibility independently of relevance scoring.”
Benefits, trade-offs, and production considerations
- Reciprocal rank fusion combines ranks using terms such as
1/(constant + rank), so incompatible raw score scales do not need to be added directly. - Prefer eligibility filtering during retrieval; merely deleting unauthorized results after top-k can underfill results and may expose data upstream.