MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / topk_limits_results

Function topk_limits_results

nodedb/src/engine/vector/sparse/search.rs:144–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142
143 #[test]
144 fn topk_limits_results() {
145 let mut idx = SparseInvertedIndex::new();
146 for i in 1..=100 {
147 idx.insert(&format!("doc{i}"), &make_sv(&[(1, i as f32)]));
148 }
149
150 let query = make_sv(&[(1, 1.0)]);
151 let results = dot_product_topk(&idx, &query, 5);
152 assert_eq!(results.len(), 5);
153 // Highest scores should be doc100, doc99, ...
154 assert!((results[0].score - 100.0).abs() < 1e-6);
155 }
156
157 #[test]
158 fn empty_query() {

Callers

nothing calls this directly

Calls 3

dot_product_topkFunction · 0.85
make_svFunction · 0.70
insertMethod · 0.45

Tested by

no test coverage detected