Expand description
Rank fusion for hybrid search.
Combine results from multiple retrievers (BM25, dense, sparse) into a single ranking.
use rank_fusion::rrf;
let bm25 = vec![("d1", 12.5), ("d2", 11.0)];
let dense = vec![("d2", 0.9), ("d3", 0.8)];
let fused = rrf(&bm25, &dense);
// d2 ranks highest (appears in both lists)§Algorithms
| Function | Uses Scores | Best For |
|---|---|---|
rrf | No | Incompatible score scales |
isr | No | When lower ranks matter more |
combsum | Yes | Similar scales, trust scores |
combmnz | Yes | Reward overlap between lists |
borda | No | Simple voting |
weighted | Yes | Custom retriever weights |
dbsf | Yes | Different score distributions |
All have *_multi variants for 3+ lists.
§Performance Notes
OpenSearch benchmarks (BEIR) show RRF is ~3-4% lower NDCG than score-based
fusion (CombSUM), but ~1-2% faster. RRF excels when score scales are
incompatible or unknown. See OpenSearch RRF blog.
Modules§
- prelude
- Prelude for common imports.
Structs§
- Fusion
Config - Configuration for rank-based fusion (Borda,
CombSUM,CombMNZ). - RrfConfig
- RRF configuration.
- Weighted
Config - Weighted fusion configuration.
Enums§
- Fusion
Error - Errors that can occur during fusion.
- Fusion
Method - Unified fusion method for dispatching to different algorithms.
Functions§
- borda
- Borda count voting — position-based scoring.
- borda_
multi - Borda count for 3+ result lists.
- borda_
with_ config - Borda count with configuration.
- combmnz
- Normalized sum × overlap count (rewards agreement).
- combmnz_
multi CombMNZfor 3+ result lists.- combmnz_
with_ config CombMNZwith configuration.- combsum
- Sum of min-max normalized scores.
- combsum_
multi CombSUMfor 3+ result lists.- combsum_
with_ config CombSUMwith configuration.- dbsf
- Distribution-Based Score Fusion (DBSF).
- dbsf_
multi - DBSF for 3+ result lists.
- dbsf_
with_ config - DBSF with configuration.
- isr
- Inverse Square Root rank fusion with default config (k=1).
- isr_
multi - ISR for 3+ result lists.
- isr_
with_ config - ISR with custom configuration.
- rrf
- Reciprocal Rank Fusion of two result lists with default config (k=60).
- rrf_
into - RRF with preallocated output buffer.
- rrf_
multi - RRF for 3+ result lists.
- rrf_
weighted - Weighted RRF: per-retriever weights applied to rank-based scores.
- rrf_
with_ config - RRF with custom configuration.
- weighted
- Weighted score fusion with configurable retriever trust.
- weighted_
multi - Weighted fusion for 3+ result lists.
Type Aliases§
- Result
- Result type for fusion operations.