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

Function exact_results

nodedb-vector/src/flat.rs:372–381  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

370
371 #[test]
372 fn exact_results() {
373 let mut idx = FlatIndex::new(2, DistanceMetric::Cosine);
374 idx.insert(vec![1.0, 0.0]);
375 idx.insert(vec![0.0, 1.0]);
376 idx.insert(vec![1.0, 1.0]);
377
378 let results = idx.search(&[1.0, 0.0], 1);
379 assert_eq!(results.len(), 1);
380 assert_eq!(results[0].id, 0);
381 }
382
383 #[test]
384 fn empty_search() {

Callers

nothing calls this directly

Calls 2

insertMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected