1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//! Collection metadata, named vector configuration, and programmatic API.
//!
//! Collections are named containers for entities with associated vector
//! configurations. Each collection defines named vector spaces with their
//! dimensions, distance metrics, and index configurations.
//!
//! # Overview
//!
//! A collection in ManifoldDB is similar to a table in relational databases,
//! but with built-in support for multiple named vectors per entity. This allows
//! storing and querying different embedding types together:
//!
//! - Dense vectors (e.g., BERT, OpenAI embeddings)
//! - Sparse vectors (e.g., SPLADE, BM25)
//! - Multi-vectors (e.g., ColBERT token embeddings)
//! - Binary vectors (e.g., LSH, SimHash)
//!
//! # Programmatic API
//!
//! The collection API provides a fluent interface for creating collections,
//! managing points, and performing vector search.
//!
//! ## Creating a Collection
//!
//! ```ignore
//! use manifoldb::collection::DistanceMetric;
//!
//! // Create a collection with multiple named vectors
//! let collection = db.create_collection("documents")
//! .with_dense_vector("text", 768, DistanceMetric::Cosine)
//! .with_sparse_vector("keywords")
//! .build()?;
//! ```
//!
//! ## Point Operations
//!
//! ```ignore
//! use manifoldb::collection::{PointStruct, Vector};
//! use serde_json::json;
//!
//! // Upsert a point
//! collection.upsert_point(PointStruct::new(1)
//! .with_payload(json!({"title": "Rust Book", "category": "programming"}))
//! .with_vector("text", vec![0.1; 768]))?;
//!
//! // Get a point's payload
//! let payload = collection.get_payload(1.into())?;
//! ```
//!
//! ## Vector Search
//!
//! ```ignore
//! use manifoldb::collection::Filter;
//!
//! // Simple search
//! let results = collection.search("text")
//! .query(query_vector)
//! .limit(10)
//! .execute()?;
//!
//! // Search with filter
//! let results = collection.search("text")
//! .query(query_vector)
//! .limit(10)
//! .filter(Filter::eq("category", "programming"))
//! .with_payload(true)
//! .execute()?;
//!
//! // Hybrid search (multiple vectors)
//! let results = collection.hybrid_search()
//! .query("text", dense_vector, 0.7)
//! .query("keywords", sparse_vector, 0.3)
//! .limit(10)
//! .execute()?;
//! ```
//!
//! # DDL Syntax
//!
//! Collections can also be created using SQL-like DDL:
//!
//! ```sql
//! CREATE COLLECTION documents (
//! dense VECTOR(768) USING hnsw WITH (distance = 'cosine'),
//! sparse SPARSE_VECTOR USING inverted,
//! colbert MULTI_VECTOR(128) USING hnsw WITH (aggregation = 'maxsim')
//! );
//! ```
// Configuration types
pub use ;
// Manager and metadata types
pub use ;
pub use ;
// Programmatic API types
pub use CollectionBuilder;
pub use ;
pub use Filter;
pub use CollectionHandle;
pub use ;
pub use ;
// Re-export distance metrics from manifoldb-vector for convenience
pub use SparseDistanceMetric;
pub use DistanceMetric;