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

Function parse_single_search_result

nodedb-client/src/native/response_parse.rs:39–48  ·  view source on GitHub ↗
(v: &serde_json::Value)

Source from the content-addressed store, hash-verified

37}
38
39fn parse_single_search_result(v: &serde_json::Value) -> Option<SearchResult> {
40 let id = v.get("id")?.as_str()?.to_string();
41 let distance = v.get("distance")?.as_f64()? as f32;
42 Some(SearchResult {
43 id,
44 node_id: None,
45 distance,
46 metadata: HashMap::new(),
47 })
48}
49
50/// Parse a graph traversal response into a SubGraph.
51pub(crate) fn parse_subgraph_response(

Callers 2

parse_search_resultsFunction · 0.85

Calls 4

to_stringMethod · 0.80
as_strMethod · 0.45
getMethod · 0.45
as_f64Method · 0.45

Tested by 1