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

Function insert_and_lookup

nodedb/src/engine/vector/sparse/index.rs:225–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223
224 #[test]
225 fn insert_and_lookup() {
226 let mut idx = SparseInvertedIndex::new();
227 let sv = make_sv(&[(10, 0.5), (20, 0.8)]);
228 idx.insert("doc1", &sv);
229
230 assert_eq!(idx.doc_count(), 1);
231 assert_eq!(idx.dim_count(), 2);
232
233 let postings = idx.get_postings(10).unwrap();
234 assert_eq!(postings.len(), 1);
235 assert_eq!(postings[0].1, 0.5);
236 }
237
238 #[test]
239 fn upsert_replaces() {

Callers

nothing calls this directly

Calls 3

make_svFunction · 0.70
insertMethod · 0.45
get_postingsMethod · 0.45

Tested by

no test coverage detected