pub mod fusion;
pub mod provider;
pub mod rrf;
pub mod types;
pub use fusion::{combmnz_fuse, normalize_minmax, weighted_sum_fuse};
pub use provider::{KeywordIndex, SearchProvider};
pub use rrf::rrf_fuse;
pub use types::SearchResult;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn two_providers_compose_via_rrf() {
let keywords = KeywordIndex::new(vec![
("shared".to_string(), "rust async runtime tokio".to_string()),
(
"kw_only".to_string(),
"rust ownership borrowing".to_string(),
),
]);
let semantic = KeywordIndex::new(vec![
("shared".to_string(), "rust async runtime tokio".to_string()),
("sem_only".to_string(), "rust green threads mio".to_string()),
]);
let kw_results = keywords.search("rust async", 10).unwrap();
let sem_results = semantic.search("rust async", 10).unwrap();
let fused = rrf_fuse(&[kw_results, sem_results], 60);
assert!(!fused.is_empty());
assert_eq!(fused[0].id, "shared");
}
}