velesdb_core/collection/vector_collection/mod.rs
1//! `VectorCollection`: newtype wrapper around `Collection` for vector workloads.
2//!
3//! This type provides a stable, typed API for vector collections.
4//! Internally it delegates 100% to the `Collection` executor to avoid
5//! any data synchronisation issues between separate storage layers.
6
7mod accessors;
8mod crud;
9mod lifecycle;
10mod search;
11#[cfg(test)]
12mod search_tests;
13#[cfg(test)]
14mod traverse_tests;
15
16use crate::collection::types::Collection;
17
18/// A vector collection combining HNSW search, payload storage, and full-text search.
19///
20/// `VectorCollection` is a typed newtype over `Collection` that provides
21/// a stable public API for vector workloads. All storage operations delegate
22/// to the single `inner: Collection` instance — no dual-storage desync.
23///
24/// # Examples
25///
26/// ```rust,no_run
27/// use velesdb_core::{VectorCollection, DistanceMetric, Point, StorageMode};
28/// use serde_json::json;
29///
30/// let coll = VectorCollection::create(
31/// "./data/docs".into(),
32/// "docs",
33/// 768,
34/// DistanceMetric::Cosine,
35/// StorageMode::Full,
36/// )?;
37///
38/// coll.upsert(vec![
39/// Point::new(1, vec![0.1; 768], Some(json!({"title": "Hello"}))),
40/// ])?;
41///
42/// let results = coll.search(&vec![0.1; 768], 10)?;
43/// # Ok::<(), velesdb_core::Error>(())
44/// ```
45#[derive(Clone)]
46pub struct VectorCollection {
47 /// Single source of truth — all operations delegate here.
48 pub(crate) inner: Collection,
49}