Hybrid retrieval runs a keyword retriever and a vector retriever side by side and merges their ranked lists. Their scores live on different scales, so merge by rank instead.
Implement reciprocal_rank_fusion(rankings, k=60, weights=None, top_n=None).
rankings: list of ranked lists of document ids, best first. Ids are all strings or all integers. If an id repeats inside one list, only its first position counts.weights defaults to 1 for every list.top_n: keep only the first top_n results (None keeps all).Return a list of (doc_id, score) tuples with the score rounded to 6 decimals. Empty input returns [].