Hybrid search RAG: finding the exact terms vectors miss

A user searched a support assistant for the error code "E-4021" and got a careful, well-written answer about three unrelated errors. The code sat in the documentation the whole time. Nothing was wrong with the model or the writing; the retrieval step simply never pulled the right chunk, because vector search matches on meaning and an exact string like a code has no meaning to match. Hybrid search RAG exists to close exactly this gap, pairing the semantic search that handles open questions with the keyword search that handles exact ones.
Most "the answer was in the docs but it didn't find it" complaints are exact-match misses, not reasoning failures. A code, a SKU, a part number, or a person's name is the one query type users expect to be flawless, and pure vector search is quietly weakest there. The fix is rarely a better embedding model; it is adding keyword search back alongside it and merging the two result sets well.
The rest comes down to one idea applied in steps — keep keyword search alongside the embeddings, merge the two sets with Reciprocal Rank Fusion, and bring in a reranker only when precision at the top has to be exact.
Why vector search misses exact terms and IDs
Vector search misses exact terms because it is built to match meaning, and an identifier carries none to match. An embedding model turns text into a vector that captures semantic sense, so the query and the documents are compared by conceptual closeness rather than by the characters they contain. That is exactly what makes semantic search strong at open questions and weak at precise ones: a code, an SKU, or a rare proper name has little semantic content, so the model places it somewhere vague and the chunk that actually contains it never rises to the top.
Microsoft states the boundary plainly for its own search engine: querying over "product codes, highly specialized jargon, dates, and people's names" performs better with keyword search because it can identify exact matches. This is a retrieval failure, not a generation one — the model answers confidently from whatever chunks it was handed, so a wrong-but-fluent reply hides the fact that the right passage was never retrieved. It is the same root cause behind fixing RAG retrieval in general, narrowed to the one query type users least forgive getting wrong, and it shapes the reliability of every lookup in your production AI systems.

Keyword search still earns its place
Keyword search is precise where vector search is vague, so it belongs in a modern RAG system rather than being replaced by it. The long-standing algorithm here is BM25, which ranks documents by how often and how rarely the query terms appear in them. Elastic describes the trade-off directly: BM25 matches exact terms, making it highly precise and explainable, which is the quality you want for a code or an ID. Because it works on the literal tokens, it finds "E-4021" because the characters are there, not because the string means anything.
That precision comes with its own blind spot, which is the mirror image of the vector one. Keyword search struggles when the user's words differ from the document's — a search for "laptop won't charge" may miss a passage about "battery not detected" — because it has no notion of meaning. So the two methods fail on opposite query types: semantic on exact strings, keyword on paraphrases. Running only one leaves half your queries poorly served, which is the case for using both.
Hybrid search runs both and merges the results
Hybrid search queries the vector index and the keyword index together and combines their results into one ranked list. As Microsoft puts it, hybrid search is a single request configured for both full-text and vector queries, and it "combines the strengths of vector search and keyword search." Elastic frames it the same way — hybrid search combines lexical or BM25 and semantic search into one ranked list. The point is coverage: a meaning-based query and an exact-string query both find their best match in the same system, so the error code and the open question are each served by the method that handles them well. This is the core of practical search and retrieval relevance for a RAG assistant.
The design cost of hybrid search is modest. You maintain two indexes over the same content — a vector index and a keyword index — and run both at query time, which adds a little infrastructure and a second lookup per query. For most teams that is a small price next to the alternative, which is a retrieval system that silently fails on every code and ID a user types. The one real decision is how to merge the two result sets, which is the next step.
Wiring two indexes, a fusion step, and an optional reranker into an existing RAG pipeline is a focused piece of work with a clear payoff on exact-match queries. Our engineers have built hybrid retrieval on live systems where codes and IDs had to be found every time. Build yours with engineers who build hybrid retrieval.
Merge the two result sets with Reciprocal Rank Fusion
The clean way to combine keyword and vector results is Reciprocal Rank Fusion, which merges by rank position rather than by raw score. The two searches produce scores on different scales that can't be compared directly, and RRF sidesteps that entirely: as Elastic describes it, RRF ignores raw scores and focuses on how high a document appears in each list. A document ranked near the top of either search rises in the merged list, so a chunk the keyword search found first for an exact code competes fairly with one the vector search found first for a concept.
RRF is a well-established method, not a vendor trick. The original paper by Cormack and colleagues is titled, flatly, Reciprocal Rank Fusion outperforms Condorcet and individual rank learning methods, and it needs no per-query tuning, which is why both Azure AI Search and Elastic offer it as a built-in default. For most teams it is the right place to start: turn on hybrid retrieval, merge with RRF, and measure. Hand-tuned score weighting is an option later if the data demands it, but it rarely beats RRF enough to justify the maintenance.
Add a reranker when precision has to be high
When the top result has to be right, add a reranking stage after retrieval. Hybrid search and RRF give you a strong shortlist; a reranker reorders that shortlist so the single best chunk lands first. The established pattern is two-stage: the Sentence-Transformers documentation describes retrieving a list of candidates and then, in a second stage, using a cross-encoder that scores the relevancy of all candidates. A cross-encoder reads the query and a candidate together rather than as separate vectors, so it judges relevance more accurately than the first-stage retrieval can.
That accuracy has a cost, which is why reranking is a second stage and not the whole system. Scoring each candidate against the query is slower and more expensive than a vector lookup, so you run it on a shortlist of a few dozen, never the whole index. The sensible order is to add it only once hybrid search is in place and you still need better precision at the very top — for a support assistant answering open questions, RRF may be enough; for a system where the first answer must be exact, the reranker earns its latency.
This matters most for high-value exact lookups, such as product search over codes and SKUs, where showing the wrong item first is a lost sale.
The full retrieval stack reads as a short progression, each layer added only when the one before it isn't enough:
Where hybrid search fits with the rest of RAG
Hybrid search solves the exact-match problem; it does not solve every retrieval problem, and it helps to know the boundary. It assumes the right content was extracted and indexed in the first place — if a table was flattened or a scanned page was never read, no amount of keyword or vector search will find what isn't there. That ingestion problem is a separate piece of work, covered in a companion article on handling real documents. Likewise, hybrid search finds what is in the index, but not whether the index is current; a stale index returns confidently outdated answers, which is its own topic.
Treated as one layer in a retrieval stack, hybrid search is the layer that makes exact lookups reliable, and it composes cleanly with the rest. Get the content in correctly, keep the index fresh, retrieve with hybrid search and RRF, and rerank when precision demands it — each stage does one job, and together they turn a RAG assistant that fumbles codes into one that finds them every time. The sequence matters more than any single component, because a weak stage upstream caps how well the ones after it can perform.
Key takeaways
- Vector search matches meaning, so it misses exact strings — codes, IDs, SKUs, names — that carry no semantic content, and that shows up as answers the user knows are in the docs.
- Keyword search (BM25) matches exact terms and is precise and explainable, which is exactly where vector search is weak; the two fail on opposite query types.
- Hybrid search runs both a vector index and a keyword index and merges the results, so meaning-based and exact queries are each served by the method that handles them.
- Reciprocal Rank Fusion merges the two result sets by rank rather than raw score, needs no per-query tuning, and is the right default to start with.
- Add a cross-encoder reranker as a second stage only when the top result must be exact, since it trades latency for precision on a shortlist.
Why exact-match retrieval is worth fixing first
A RAG assistant that handles open questions but fumbles codes and IDs has a retrieval gap, not a model problem, and the fix is well understood. Keep keyword search alongside the embeddings, run them together as hybrid search, merge with Reciprocal Rank Fusion, and add a reranker only where the first result has to be perfect. Each step is modest and each is measurable, and together they close the one gap users notice fastest: the exact lookup that should never fail. Fix that before reaching for a bigger model, because a bigger model cannot retrieve a chunk that search never surfaced.
If your RAG assistant is strong on open questions but loses codes, names, and IDs, that exact-match gap is worth closing before anything else — close the exact-match gap in your RAG system with our team.
FAQ
Interesting For You

n8n workflow reliability: when AI automations fail silently
The quiet failures have specific causes, and n8n has specific places to catch them: validate the AI output, route every error through one workflow, retry with backoff and idempotency, park what still fails in a capture queue, and alert even when a run processed nothing.
Read article

AI coding assistants for teams without quality slipping
Quality slips for a reason, and a handful of guardrails hold it steady without giving up the speed: one review bar for everyone, small pull requests, tests that actually test, CI gates doing the enforcing, and an author accountable for every change.
Read article

Multimodal RAG: why your RAG breaks on real documents
The break happens at ingestion, and so does the fix: parse for layout instead of flat text, run OCR on scans, pull tables out as structure, and let a vision model turn figures and dense tables into text a retriever can actually find.
Read article


