How It Works
The implementation depends on the vector database. A hybrid search generally:- Computes a vector similarity signal.
- Computes a lexical signal from the query and document text.
- Combines or fuses the signals into one ranking.
vector_score_weight between 0 and 1 to control their relative contribution. The default is 0.5.
Chroma runs vector search and a lexical candidate search, then merges their rankings with Reciprocal Rank Fusion (RRF). Its lexical path filters on the first query token and scores term overlap.
Each vector database maps
SearchType.hybrid to its own query and ranking algorithm. Check the selected integration before tuning retrieval.When to Use Hybrid Search
Evaluate the available search types against representative queries and expected documents. Ranking behavior also depends on the embedder, content, chunking strategy, and database configuration.
Configuration
Basic Setup
With Reranking
Apply a reranker to the fused candidates:Chroma RRF Constant
For Chroma,hybrid_rrf_k controls how strongly rank position affects the fused score. Higher values reduce the difference between adjacent ranks. The default is 60.
Example
Install the dependencies used on this page and start a PostgreSQL instance with pgvector enabled:hybrid_search.py