How It Works
Hybrid search runs two searches in parallel:- Vector search finds semantically similar content (meaning-based)
- Keyword search finds exact term matches (text-based)
- Fusion combines results using Reciprocal Rank Fusion (RRF)
RRF(d) = Σ 1/(k + rank)
This ensures documents that rank well in both searches appear at the top, while documents that only match one method still surface.
Not all vector databases support hybrid search or RRF.
When to Use Hybrid Search
Use vector-only if your queries are always conceptual with no specific terms.
Use keyword-only if you need exact matching (e.g., search by ID or code).
Configuration
Basic Setup
With Reranking
Add a reranker to improve result ordering after fusion:RRF Constant
Thek constant in RRF controls how much weight lower-ranked results receive. Higher values (e.g., 60) smooth out rankings; lower values make top results more dominant.
Example
hybrid_search.py