distx_core/lib.rs
1//! # DistX Core
2//!
3//! Core library for the DistX 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 distx_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;
47
48/// SIMD-optimized vector operations
49///
50/// Provides hardware-accelerated distance calculations:
51/// - AVX2/FMA on x86_64
52/// - SSE on x86
53/// - NEON on ARM64/Apple Silicon
54pub mod simd;
55
56pub use collection::{Collection, CollectionConfig, Distance};
57pub use vector::Vector;
58pub use error::{Error, Result};
59pub use point::{Point, PointId};
60pub use hnsw::HnswIndex;
61pub use graph::{Node, Edge, NodeId, EdgeId};
62pub use bm25::BM25Index;
63pub use filter::{Filter, PayloadFilter, FilterCondition};
64