Expand description
First-class VECTOR value type.
LoraDB VECTOR values are fixed-dimension, typed numeric coordinate
collections. A LoraVector can be stored directly as a node or
relationship property, returned through every binding, compared for
equality, and used as input to the built-in vector math functions
(vector.similarity.cosine, vector.similarity.euclidean,
vector_distance, vector_norm, vector_dimension_count,
toIntegerList, toFloatList).
Vector indexes and approximate kNN are intentionally out of scope for
this pass — exhaustive search via ORDER BY vector.similarity.*(…) LIMIT k works today; an index-backed variant is future work.
Structs§
- Lora
Vector - A first-class VECTOR value.
Enums§
- RawCoordinate
- Raw numeric input for one coordinate before it has been coerced into the destination coordinate type. Executors / binding layers feed values through this enum so the coercion rules live in one place.
- Vector
Build Error - Error returned by
LoraVector::try_new. Kept as a concrete enum so the executor can render a single-line error message without inspecting the underlying cause. - Vector
Coordinate Type - Canonical coordinate type for a vector.
- Vector
Values - Internal storage for a vector. One variant per supported coordinate
type; dimension is implicit in the inner
Vec’s length.
Constants§
- MAX_
VECTOR_ DIMENSION - Maximum dimension accepted by LoraDB’s
vector(...)constructor.
Functions§
- cosine_
similarity_ bounded - Cosine similarity squashed into [0, 1]. Matches the documented
vector.similarity.cosinebehaviour. - cosine_
similarity_ raw - Raw cosine similarity in the range [-1, 1]. Returns
Nonewhen either vector has zero norm, since cosine is undefined in that case. - dot_
product - Dot product (f32 arithmetic, widened back to f64).
- euclidean_
distance - Euclidean (L2) distance.
- euclidean_
distance_ squared - Squared Euclidean distance (sum of squared differences). Uses f32 arithmetic to match LoraDB’s vector function implementation.
- euclidean_
norm - Euclidean (L2) norm.
- euclidean_
similarity - Similarity score derived from squared Euclidean distance:
1 / (1 + d²). For the documented example wheredistance² == 22, this yields1 / 23 ≈ 0.043478. - hamming_
distance - Hamming distance: count of positions where the two vectors differ.
- manhattan_
distance - Manhattan (L1) distance.
- manhattan_
norm - Manhattan (L1) norm.
- parse_
string_ values - Parse a string-form coordinate list, e.g.
"[1.05e+00, 0.123, 5]". Used byvector()whenvectorValueis a STRING.