Skip to content
Overview

Hybrid search

A search box that understands both what people type and what they mean: exact names and titles through BM25, related content through embeddings, merged by a reranker.

Hybrid search: an index task stores dense and BM25 sparse vectors in Milvus, and a search endpoint runs both searches and merges them with a ranker

The need

Someone types "eurovision final" or "that podcast about sleep". A pure keyword search misses synonyms, and a pure vector search can miss an exact name. You want both, in one ranked list.

How the stack handles it

Step 1 · Collect

Titles, descriptions, transcripts and topics

CODEX holds the text that people search in, and the metadata you want to filter on.

Step 2 · Compute

An index task fills two vector fields

The task sends text to peach-models for the dense embedding. Milvus builds the BM25 sparse vector itself from the same text.

Step 3 · Store

One Milvus collection, two indexes

The dense field answers "what does it mean", the sparse BM25 field answers "which words does it contain".

Step 4 · Serve

An endpoint runs both searches and reranks

The query is embedded for the dense request and passed as text to the BM25 request. A ranker such as RRF merges the two lists into one. Filters and business rules apply last.

Step 5 · Measure

Compare against what you have today

Run hybrid as an A/B variant against the current search and compare click-through, and how often people search again.

Why it is built this way

  • Each search covers the other's weakness, so exact matches and related content both appear.
  • The text is indexed once and used by both searches.
  • Reranking is a single, tunable step, so weights can change without re-indexing.

Variations

  • Weight keywords higher for navigational queries such as titles, and meaning higher for exploratory ones.
  • Add a second-stage model that re-orders the top results.

Go deeper