How it works
1
Dual indexing
Each document is embedded twice — once with a dense SentenceTransformers model (
SentenceTransformersDocumentEmbedder) to produce a float vector capturing semantic meaning, and once with a sparse SentenceTransformers model (SentenceTransformersSparseDocumentEmbedder, typically a SPLADE model) to produce a token-weight sparse vector capturing lexical features.2
Dual retrieval
At query time, the query is embedded with both the dense text embedder and the sparse text embedder to produce two query representations.
3
Score fusion
Results from the dense retriever and the sparse retriever are merged using
ResultMerger (from utils/fusion.py). The default strategy is Reciprocal Rank Fusion (RRF), which combines rankings without requiring score normalization.4
Final ranking
The fused, deduplicated result list is returned as the top-k documents.
RRF formula
k (default 60) smooths rank differences.
Pinecone hybrid indexing example
src/vectordb/haystack/hybrid_indexing/indexing/pinecone.py
Pinecone hybrid search example
src/vectordb/haystack/hybrid_indexing/search/pinecone.py
Result fusion with RRF
For backends without native hybrid support, useResultMerger:
src/vectordb/haystack/components/result_merger.py
Configuration
When to use it
Corpora with mixed query styles: some users ask in natural language, others search with domain keywords or acronyms
Enterprise knowledge bases where exact product names, codes, or identifiers matter alongside conceptual questions
Any workload where pure semantic search misses highly relevant documents that contain exact query terms
When not to use it
Settings to tune first
Common pitfalls
Supported backends
Chroma, Milvus, Pinecone, Qdrant, Weaviate.Dataset configs provided
ARC, Earnings Calls, FActScore, PopQA, TriviaQA.Next steps
Components
Add reranking after fusion for further precision improvement
Pipelines
Learn about advanced pipeline composition patterns