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

Function dist

nodedb-vector/src/navix/traversal.rs:443–453  ·  view source on GitHub ↗
(
    index: &HnswIndex,
    query: &[f32],
    node_id: u32,
    metric: nodedb_types::vector_distance::DistanceMetric,
)

Source from the content-addressed store, hash-verified

441/// Inline helper: distance from query to a stored node using the given metric.
442#[inline]
443fn dist(
444 index: &HnswIndex,
445 query: &[f32],
446 node_id: u32,
447 metric: nodedb_types::vector_distance::DistanceMetric,
448) -> f32 {
449 match index.get_vector(node_id) {
450 Some(v) => distance(query, v, metric),
451 None => f32::INFINITY,
452 }
453}
454
455// ── Tests ─────────────────────────────────────────────────────────────────────
456

Callers 5

unfiltered_search_layerFunction · 0.85
navix_search_layer_0Function · 0.85
expand_standardFunction · 0.85
expand_directedFunction · 0.85
expand_blindFunction · 0.85

Calls 2

distanceFunction · 0.50
get_vectorMethod · 0.45

Tested by

no test coverage detected