vectx_core/
lib.rs

1//! # vectX Core
2//!
3//! Core library for the vectX vector database.
4//!
5//! This crate provides the fundamental data structures and algorithms:
6//!
7//! - [`Vector`] - Dense vector representation with SIMD operations
8//! - [`Point`] - A vector with ID and optional payload
9//! - [`Collection`] - Container for points with indexing
10//! - [`HnswIndex`] - HNSW approximate nearest neighbor index
11//! - [`BM25Index`] - Full-text search with BM25 ranking
12//!
13//! ## Example
14//!
15//! ```rust
16//! use vectx_core::{Vector, Point, PointId, Collection, CollectionConfig, Distance};
17//!
18//! // Create a collection
19//! let config = CollectionConfig {
20//!     name: "test".to_string(),
21//!     vector_dim: 3,
22//!     distance: Distance::Cosine,
23//!     use_hnsw: true,
24//!     enable_bm25: false,
25//! };
26//! let collection = Collection::new(config);
27//!
28//! // Insert a point
29//! let vector = Vector::new(vec![1.0, 0.0, 0.0]);
30//! let point = Point::new(PointId::String("p1".to_string()), vector, None);
31//! collection.upsert(point).unwrap();
32//!
33//! // Search
34//! let query = Vector::new(vec![1.0, 0.0, 0.0]);
35//! let results = collection.search(&query, 10, None);
36//! ```
37
38pub mod collection;
39pub mod vector;
40pub mod error;
41pub mod point;
42pub mod hnsw;
43pub mod graph;
44pub mod bm25;
45pub mod filter;
46pub mod background;
47pub mod multivector;
48
49/// SIMD-optimized vector operations
50///
51/// Provides hardware-accelerated distance calculations:
52/// - AVX2/FMA on x86_64
53/// - SSE on x86
54/// - NEON on ARM64/Apple Silicon
55pub mod simd;
56
57pub use collection::{Collection, CollectionConfig, Distance, PayloadIndexType};
58pub use vector::Vector;
59pub use error::{Error, Result};
60pub use point::{Point, PointId, VectorData, SparseVector};
61pub use hnsw::HnswIndex;
62pub use graph::{Node, Edge, NodeId, EdgeId};
63pub use bm25::BM25Index;
64pub use filter::{Filter, PayloadFilter, FilterCondition};
65pub use multivector::{MultiVector, MultiVectorConfig, MultiVectorComparator};
66