New Tool Radar

AI Concepts

How to Blend Keyword and Vector Search in a Hybrid RAG Retriever

Run a keyword search and a vector search for the same query, fuse the ranked lists, and check exact terms stop being missed.

Schematic with three steps: Run both searches for the same query; Fuse the two ranked lists; Check the exact-term questions improve.

Dense vector search matches meaning, so it finds an answer phrased with different words, but it can miss an exact product code, error string or name. Keyword search with BM25 matches exact terms but misses paraphrases. Hybrid search combines the two signals, so each covers what the other misses. Pinecone describes two patterns: filter, then rank, and client-side fusion with reciprocal rank fusion. Qdrant does the same with prefetch queries fused by RRF or DBSF.

What you need

  • An index that holds both dense vectors and a full-text or sparse field
  • Test questions that include exact terms such as codes and names
  • A fusion method: reciprocal rank fusion, or filter-then-rank

Step 1: Run both searches for the same query

For each test question, run a dense vector search and a BM25 or sparse keyword search. Record both ranked lists before fusing, so you can see which signal found the right document.

Step 2: Fuse the two ranked lists

Merge the lists with reciprocal rank fusion, which boosts documents that rank near the top in both lists, or filter first and rank second when one signal should only narrow the pool. Qdrant runs the two searches as prefetches and fuses them in one query.

Step 3: Check the exact-term questions improve

Compare the fused results with dense-only results on the exact-term questions. If a question about an error code now finds the right document, the blend works; if nothing changes, the keyword signal may be misconfigured.

Worked example: synthetic hybrid search on 4 questions

The table below is a synthetic example. It shows the expected result of fusing two searches; no index was queried.

Question Dense only Hybrid
Error code TS-999 Missed Found at rank 1
Refund policy meaning Found Found
Product SKU A-42 Missed Found at rank 2
How to reset password Found Found

Expected result (UNTESTED). hybrid search finds both exact-term questions that dense-only search missed, and keeps the two meaning questions. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Hybrid search is the broader approach; reciprocal rank fusion is one way to merge ranked lists, not a synonym for it.
  • Fusing needs both signals to be healthy: a broken keyword index adds noise instead of signal.
  • In one published benchmark, dense-only search beat hybrid search on scientific documents, so test on your own data.
  • Filter-then-rank and client-side fusion behave differently: a filter can only narrow the pool, never re-rank it.

Sources

See all