← back to the archiveCover illustration for “Hybrid search: combining keyword and vector search”
TERM8mo ago·Published · Updated ·by Andy Padia

Hybrid search: combining keyword and vector search

In short: Hybrid search runs keyword ranking such as BM25 alongside vector similarity and fuses the two result lists, so exact terms and meaning both count.

Hybrid search combines keyword retrieval, usually BM25, with vector (embedding) retrieval and merges the two result lists into one ranking. Keyword search catches exact names, codes and rare terms; vector search catches paraphrases and intent. The merge step is often reciprocal rank fusion, which Cormack, Clarke and Büttcher described in 2009 as a simple way to combine rankings from several systems.

Hybrid search in plain words

It is like asking two librarians, one who knows every exact title and one who understands what you meant, and then combining their recommendations.

How it works

Run both searches on the same query, then merge the results with a fusion method. The keyword side is usually BM25, the ranking function reviewed by Robertson and Zaragoza in 2009. Reciprocal rank fusion (RRF) suits the merge because it uses rank positions, so the incompatible raw scores of the two searches never have to be compared. Each document scores the sum of 1/(k + rank) across the lists. The RRF paper fixed k at 60 after a pilot run and reported that the exact value was not critical.

In that paper's TREC experiments, RRF did better than any single ranking it combined. Those experiments fused classic retrieval systems, so read the result as support for fusion in general and test it on your own keyword and vector pair. You can also pass the merged top results to a reranker, or weight one side more heavily.

Example

As an illustration, take the query "error E4012 when exporting to PDF". BM25 finds the one troubleshooting page containing "E4012"; vector search finds three pages about PDF export problems. Fusion puts the exact-match page first and keeps the related pages below it.

Where you'll meet it

  • Postgres, where the pgvector README pairs vector queries with full-text search and suggests RRF to combine them
  • Search engines that add vector indexes, and vector databases that add keyword search
  • Hybrid retriever options in RAG frameworks
  • Enterprise search over tickets, logs and documentation

What it changes for you

For developers, hybrid search is a cheap accuracy gain to try before you reach for bigger models. For data teams, it means keeping two indexes in sync. For product teams, it removes a common embarrassment: AI search failing to find a page that contains the exact phrase the user typed.

Hybrid search vs reranking

Hybrid search decides which candidates are found. Reranking reorders a short candidate list with a more precise model. They work well together.

Common mistake

My view: adding hybrid search and never checking the weighting on your own queries. Support logs, legal text and product catalogues need very different balances. Keep a small labelled query set and tune against it.

BM25 · Vector search · Reranking · Semantic search · Retrieval-augmented generation

From the archive: Why your RAG pipeline returns irrelevant results

Tune the keyword and vector balance against a small labelled set of your own queries.

#field-guide#search#retrieval#rag#vector-search

Sources

  1. cormack.uwaterloo.ca/cormacksigir09-rrf.pdf
  2. staff.city.ac.uk/~sbrp622/papers/foundations_bm25_review.pdf
  3. github.com/pgvector/pgvector
← older drop
Agent loop: think, act, observe, repeat
newer drop →
Prompt caching: paying less for repeated context

related drops

explore all 557 drops →
← back to the archiveday 175