pub fn rrf_fuse(lists: &[(f64, &Vec<i64>)], rrf_k: f64) -> HashMap<i64, f64>Expand description
Fuse multiple ranked lists of integer IDs via Reciprocal Rank Fusion.
Each element of lists is (weight, ranked_ids) where ranked_ids is
ordered best-first (index 0 = rank 1).
Returns a HashMap<id, combined_score> using un-normalised RRF scores.
Higher score means higher relevance.
§Examples
use sqlite_graphrag::storage::fusion::rrf_fuse;
// Two lists with equal weight — item 1 appears in both at rank 1 and 2
// so it accumulates more score than item 2 (rank 2) or item 3 (rank 1 only).
let knn: Vec<i64> = vec![1, 2];
let fts: Vec<i64> = vec![1, 3];
let scores = rrf_fuse(&[(1.0, &knn), (1.0, &fts)], 60.0);
assert!(scores[&1] > scores[&2]);
assert!(scores[&1] > scores[&3]);