Hybrid search and metadata filtering
Words made simple
A few useful meanings before you read the explanation.
- Metadata
- Extra information describing a record, such as its owner, date, policy version or document type.
- Hybrid search
- Combining exact-word search with meaning-based search to benefit from both.
- Vector
- An ordered list of numbers. An embedding is a vector used to represent content for tasks such as similarity search.
More words from this lesson
- Retrieval
- Finding and fetching information that is useful for the current question.
- Authorization
- Checking what that identity is allowed to read or do. Being logged in does not grant access to every record.
- Tenant
- A customer or organization whose data must stay separate from other customers in a shared application.
- BM25
- A method for ranking documents using query-word matches and document statistics. It is useful when exact terms matter.
Overview
- 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.
Can you explain it without the notes?
Hybrid search and metadata filtering
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
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…
Turn this concept into a clear answer.
Practice this conceptAdapted from 13_AI.MD · “Hybrid search and metadata filtering”. Examples are study fragments; framework behavior can depend on your version.