RRF Hybrid Fusion
mediumA company search box runs two engines on every query and shows one combined list: a keyword engine and a meaning engine. Each returns its own ranked list of documents, and their raw scores are in different units, a 0.87 from one and a 14.2 from the other, so no rescale makes them comparable. Reciprocal rank fusion, usually abbreviated RRF, is the standard merge, and its trick is to never read the scores at all, only positions: each document scores as the sum, over the lists it appears in, of 1 divided by (k plus its 1-based rank), with k = 60 as the standard constant. Implement rrf_fusion(list_a, list_b, k=60) and return the document ids sorted by fused score, best first. Ties are real here and worth taking seriously: break them toward the document that appeared first across the two lists, scanning in input order. k = 0 is a legal argument and a useful probe of what the constant actually does.
Run your code to see output