reddb_types/distance.rs
1//! Vector distance-metric AST leaf (ADR 0053, RQL Phase 2 S4b).
2//!
3//! [`DistanceMetric`] is referenced by the canonical SQL AST
4//! (`CreateVectorQuery.metric`, `SearchCommand` metric slots). Only the metric
5//! *enum* lives here — the SIMD-accelerated distance computations stay in the
6//! server engine (`storage::engine::distance`), which keeps a re-export shim.
7
8/// Distance metric types supported by vector operations
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
10pub enum DistanceMetric {
11 /// Euclidean (L2) distance - good for dense vectors
12 #[default]
13 L2,
14 /// Cosine distance - good for normalized embeddings
15 Cosine,
16 /// Inner product (dot product) - for maximum inner product search
17 InnerProduct,
18}