pub struct Collection { /* private fields */ }Expand description
A collection of vectors with metadata
Implementations§
Source§impl Collection
impl Collection
pub fn new(config: CollectionConfig) -> Self
Sourcepub fn next_operation_id(&self) -> u64
pub fn next_operation_id(&self) -> u64
Get next operation ID (atomically increments counter)
pub fn name(&self) -> &str
pub fn vector_dim(&self) -> usize
pub fn distance(&self) -> Distance
pub fn use_hnsw(&self) -> bool
pub fn enable_bm25(&self) -> bool
pub fn count(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn get_all_points(&self) -> Vec<Point>
pub fn get_all_points(&self) -> Vec<Point>
Get all points in the collection
Sourcepub fn start_batch(&self)
pub fn start_batch(&self)
Start batch insert mode
Sourcepub fn batch_upsert_with_prewarm(
&self,
points: Vec<Point>,
prewarm: bool,
) -> Result<()>
pub fn batch_upsert_with_prewarm( &self, points: Vec<Point>, prewarm: bool, ) -> Result<()>
Batch insert with optional pre-warming
Sourcepub fn set_payload(&self, id: &str, payload: Value) -> Result<bool>
pub fn set_payload(&self, id: &str, payload: Value) -> Result<bool>
Set payload values for a point (merge with existing)
Sourcepub fn overwrite_payload(&self, id: &str, payload: Value) -> Result<bool>
pub fn overwrite_payload(&self, id: &str, payload: Value) -> Result<bool>
Overwrite entire payload for a point
Sourcepub fn delete_payload_keys(&self, id: &str, keys: &[String]) -> Result<bool>
pub fn delete_payload_keys(&self, id: &str, keys: &[String]) -> Result<bool>
Delete specific payload keys from a point
Sourcepub fn clear_payload(&self, id: &str) -> Result<bool>
pub fn clear_payload(&self, id: &str) -> Result<bool>
Clear all payload from a point
Sourcepub fn update_vector(&self, id: &str, vector: Vector) -> Result<bool>
pub fn update_vector(&self, id: &str, vector: Vector) -> Result<bool>
Update vector for a point
Sourcepub fn update_multivector(
&self,
id: &str,
multivector: Option<MultiVector>,
) -> Result<bool>
pub fn update_multivector( &self, id: &str, multivector: Option<MultiVector>, ) -> Result<bool>
Update multivector for a point
Sourcepub fn delete_vector(&self, id: &str) -> Result<bool>
pub fn delete_vector(&self, id: &str) -> Result<bool>
Delete vector (set to empty) - for named vectors this would delete specific vector
Sourcepub fn create_payload_index(
&self,
field_name: &str,
index_type: PayloadIndexType,
) -> Result<bool>
pub fn create_payload_index( &self, field_name: &str, index_type: PayloadIndexType, ) -> Result<bool>
Create a payload field index
Sourcepub fn delete_payload_index(&self, field_name: &str) -> Result<bool>
pub fn delete_payload_index(&self, field_name: &str) -> Result<bool>
Delete a payload field index
Sourcepub fn get_payload_indexes(&self) -> HashMap<String, PayloadIndexType>
pub fn get_payload_indexes(&self) -> HashMap<String, PayloadIndexType>
Get all payload indexes
Sourcepub fn is_field_indexed(&self, field_name: &str) -> bool
pub fn is_field_indexed(&self, field_name: &str) -> bool
Check if a field is indexed
Sourcepub fn prewarm_index(&self) -> Result<()>
pub fn prewarm_index(&self) -> Result<()>
Pre-warm HNSW index
Sourcepub fn search(
&self,
query: &Vector,
limit: usize,
filter: Option<&dyn Filter>,
) -> Vec<(Point, f32)>
pub fn search( &self, query: &Vector, limit: usize, filter: Option<&dyn Filter>, ) -> Vec<(Point, f32)>
Search for similar vectors Uses brute-force for small datasets (<1000), HNSW for larger ones
Sourcepub fn search_multivector(
&self,
query: &MultiVector,
limit: usize,
filter: Option<&dyn Filter>,
) -> Vec<(Point, f32)>
pub fn search_multivector( &self, query: &MultiVector, limit: usize, filter: Option<&dyn Filter>, ) -> Vec<(Point, f32)>
Search using multivector MaxSim scoring (ColBERT-style)
For each sub-vector in the query, finds the maximum similarity with any sub-vector in each document, then sums all maximums.
Sourcepub fn search_sparse(
&self,
query: &SparseVector,
vector_name: &str,
limit: usize,
filter: Option<&dyn Filter>,
) -> Vec<(Point, f32)>
pub fn search_sparse( &self, query: &SparseVector, vector_name: &str, limit: usize, filter: Option<&dyn Filter>, ) -> Vec<(Point, f32)>
Search using sparse vectors (dot product on matching indices)
Auto Trait Implementations§
impl Freeze for Collection
impl !RefUnwindSafe for Collection
impl Send for Collection
impl Sync for Collection
impl Unpin for Collection
impl !UnwindSafe for Collection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more