aiondb-vector

Vector type support for the engine. Centralises distance functions, index descriptors, quantization codecs, and the planner-side backend registry used by similarity search. The runtime VectorValue itself lives in aiondb-core and is re-exported here.

cargo

[dependencies]
aiondb-vector = { path = "../aiondb-vector" }

modules

modulepurpose
distancedistance functions and the VectorDistance enum.
indexVectorIndexDescriptor and VectorIndexAlgorithmParams.
plannerbuild_vector_search_plan entry points.
planner_backendsbackend trait, registry, and built-in hnsw / ivf_flat backends.
quantizationscalar, binary, and product quantization codecs.
simdarchitecture dispatch for distance kernels (x86, arm, scalar fallback).
typesthin type helpers used by the planner.

key types

itemdescription
VectorValuere-export of the core vector value (element type plus dims).
VectorDistanceL2, Cosine, InnerProduct, Manhattan.
VectorIndexDescriptorcatalog index id, algorithm, params, distance metric.
VectorIndexAlgorithmParamsHnsw(HnswParams) or Custom(BTreeMap<String, String>).
VectorSearchAlgorithm, VectorSearchSpec, VectorSearchPlan, VectorDistanceMetricre-exports from aiondb-plan.
VectorSearchBackend, VectorSearchBackendRegistryextension point for new ANN algorithms.
QuantizationKindNone, Scalar, Binary, Product.
VectorQuantizer traitencode, decode, approx_l2.
ScalarQuantizer / ScalarCodeint8 scalar quantization.
BinaryQuantizer / BinaryCodesign-bit binary quantization, packed Vec<u64>.
ProductQuantizer / ProductCodeproduct quantization with k-means subspace centroids.
build_vector_search_plan, build_vector_search_plan_with_registryplanner entry points.
default_vector_search_backend_registryglobal registry pre-loaded with built-in backends.

distance functions

use aiondb_vector::distance::{
    cosine_distance, inner_product, l2_distance, manhattan_distance,
};

let a = [1.0_f32, 0.0, 0.0];
let b = [0.0_f32, 1.0, 0.0];

let _l2 = l2_distance(&a, &b);
let _cos = cosine_distance(&a, &b);
let _ip = inner_product(&a, &b);
let _l1 = manhattan_distance(&a, &b);

example

use aiondb_core::IndexId;
use aiondb_vector::{VectorDistance, VectorIndexDescriptor};

let descriptor = VectorIndexDescriptor::hnsw(
    IndexId::new(7),
    16,
    200,
    VectorDistance::Cosine,
);

assert!(matches!(descriptor.distance_metric, VectorDistance::Cosine));