Skip to content
Back to the journal
AI & automationFIELD NOTES / 39

Hybrid search for RAG: combining keywords and meaning

Learn how hybrid search combines lexical and semantic retrieval, how reciprocal rank fusion works, and how to evaluate better evidence selection for RAG.

Connected luminous nodes surrounding a central processing core, illustrating hybrid search.
Connected luminous nodes surrounding a central processing core. Original illustration for the RaagNeet Journal.

Someone searching a help centre may type a complete question or a cryptic error code. Semantic search is useful for meaning, while keyword search preserves exact terms. Hybrid search combines these strengths. For a retrieval-augmented AI application, the aim is to retrieve evidence that actually answers the question before asking a model to write about it.

01Why two search methods help

Keyword retrieval looks for textual matches, while semantic retrieval compares learned representations of meaning. The methods fail in different ways. A synonym may evade a simple keyword query, while a rare identifier can be poorly represented by an embedding model. [1]

Imagine a library containing setup instructions and product error codes. A query about a payment callback should find conceptual guidance. A query containing PAYMENT_SIG_08 should preserve the exact identifier. A useful test set includes both, along with requests where no suitable source exists.

02Preserve context while preparing documents

Document chunks can lose meaning when detached from their parent section. Contextual retrieval approaches add information that helps situate a chunk before it is indexed. The relevant design question is whether a reader or model can understand what the passage is about when it appears alone. [2]

Keep titles, section names, version information, and source links with each chunk. Avoid using overlapping text so aggressively that the top results all repeat the same paragraph. Distinct evidence is often more useful than several almost-identical excerpts with high similarity scores.

An illustrated decision flow: Keyword matches → Semantic matches → Fuse the ranks → Rerank evidence.
A practical framework: Keyword matches → Semantic matches → Fuse the ranks → Rerank evidence. This is an illustrative workflow, not a measured benchmark.

03Combine rankings with a clear method

Keyword scores and embedding distances are not naturally on the same scale. Rank-based fusion, such as reciprocal rank fusion, combines positions in separate result lists instead of assuming their raw numbers are directly comparable. It is a useful baseline for a hybrid retrieval experiment.

Tune the candidate counts and fusion settings on representative queries. A larger candidate pool can improve coverage while increasing latency and reranking work. Keep the selected parameters with evaluation results so later changes can be compared rather than guessed at.

04Filter and rerank with care

Enforce account and document permissions in the retrieval path. An answer model should never receive a private passage on the assumption that it will choose not to quote it. Check your retrieval implementation's filtering behaviour, particularly when using approximate indexes.

A reranker can help order a candidate set for a specific query, but it cannot rescue a source that was never retrieved. Evaluate candidate recall separately from final ranking. Include stale versions and nearly relevant documents to test whether the system prefers the currently authoritative passage.

05Judge search before judging prose

Label which documents are relevant to each evaluation question. Inspect how often the required evidence appears in the candidate set and near the top of the final ranking. Then test whether the generated answer faithfully uses that evidence and acknowledges missing information.

Read failures manually. A wrong answer may come from a missing source, poor chunk boundaries, incorrect access filters, ranking, or generation. Hybrid search is one component of that chain. Keep it only when the quality improvement on your real queries justifies the added retrieval and maintenance work.

A LITTLE MORE CLARITY

Common questions

Is hybrid search always better than vector search?

No. It often helps when queries mix meaning and exact terminology, but the result depends on data, query patterns, and configuration. Compare against single-method baselines.

What does reciprocal rank fusion do?

It merges result lists using the positions of documents in each list. This avoids directly adding scores from retrieval methods whose score scales differ.

FOLLOW THE THREAD

Sources & further reading

Primary documentation and further reading are linked below. Examples and decision frameworks are illustrative; product capabilities can change.

  1. Supabase: Hybrid search and reciprocal rank fusion
  2. Anthropic: Contextual retrieval

Created with AI assistance for the RaagNeet Journal. This guide does not claim original product testing or benchmark results. Original illustrations by RaagNeet. Send a correction.

hybrid searchRAGretrieval