ragfs_store/lib.rs
1//! Vector storage layer for RAGFS.
2//!
3//! This crate provides storage backends for RAGFS, implementing the
4//! [`VectorStore`](ragfs_core::VectorStore) trait.
5//!
6//! ## Cargo Features
7//!
8//! - `lancedb` (default): Enables the `LanceDB` backend for production use
9//! - Without `lancedb`: Only `MemoryStore` is available (for testing/development)
10//!
11//! ## Backends
12//!
13//! | Backend | Description |
14//! |---------|-------------|
15//! | [`LanceStore`] | Production backend using `LanceDB` (requires `lancedb` feature) |
16//! | [`MemoryStore`] | In-memory backend for testing (always available) |
17//!
18//! ## `LanceDB` Features
19//!
20//! When the `lancedb` feature is enabled:
21//!
22//! - **Vector Search**: Fast approximate nearest neighbor search using HNSW
23//! - **Hybrid Search**: Combined FTS and vector search for better relevance
24//! - **Full CRUD**: Create, read, update, delete operations for chunks and files
25//! - **Automatic Indexing**: Creates vector and FTS indices automatically
26//!
27//! ## Example
28//!
29//! ```rust,ignore
30//! use ragfs_store::LanceStore;
31//! use ragfs_core::VectorStore;
32//!
33//! // Create and initialize store
34//! let store = LanceStore::new("path/to/db.lance".into(), 384);
35//! store.init().await?;
36//!
37//! // Store chunks
38//! store.upsert_chunks(&chunks).await?;
39//!
40//! // Search
41//! let results = store.search(query).await?;
42//! ```
43
44// LanceDB-based modules (optional)
45#[cfg(feature = "lancedb")]
46pub mod lancedb;
47#[cfg(feature = "lancedb")]
48pub mod schema;
49
50#[cfg(feature = "lancedb")]
51pub use lancedb::LanceStore;
52
53// In-memory store (always available for testing)
54pub mod memory;
55pub use memory::MemoryStore;