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

Function multi_term_query

nodedb/src/engine/sparse/sparse_vector.rs:349–360  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

347
348 #[test]
349 fn multi_term_query() {
350 let (idx, _dir) = open_test_index();
351
352 idx.index_document("docs", "d1", &vec![(1, 0.5), (2, 0.3)])
353 .unwrap();
354 idx.index_document("docs", "d2", &vec![(1, 0.2), (2, 0.9)])
355 .unwrap();
356
357 // Query both tokens: d2 should win (0.2*1.0 + 0.9*1.0 = 1.1 > 0.5 + 0.3 = 0.8).
358 let results = idx.search("docs", &vec![(1, 1.0), (2, 1.0)], 10).unwrap();
359 assert_eq!(results[0].doc_id, "d2");
360 }
361
362 #[test]
363 fn collection_isolation() {

Callers

nothing calls this directly

Calls 3

open_test_indexFunction · 0.85
index_documentMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected