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

Function encode_vector_hits

nodedb/src/data/executor/response_codec/tests.rs:6–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5#[test]
6fn encode_vector_hits() {
7 let hits = vec![
8 VectorSearchHit {
9 id: 1,
10 distance: 0.5,
11 doc_id: None,
12 body: None,
13 },
14 VectorSearchHit {
15 id: 2,
16 distance: 0.8,
17 doc_id: None,
18 body: None,
19 },
20 ];
21 let bytes = encode(&hits).unwrap();
22 assert!(!bytes.is_empty());
23
24 let json = decode_payload_to_json(&bytes);
25 assert!(json.contains("\"id\""));
26 assert!(json.contains("\"distance\""));
27}
28
29#[test]
30fn encode_count_msg() {

Callers

nothing calls this directly

Calls 2

encodeFunction · 0.70
decode_payload_to_jsonFunction · 0.70

Tested by

no test coverage detected