Collection

Struct Collection 

Source
pub struct Collection { /* private fields */ }
Expand description

A collection of vectors with metadata

Implementations§

Source§

impl Collection

Source

pub fn new(config: CollectionConfig) -> Self

Source

pub fn next_operation_id(&self) -> u64

Get next operation ID (atomically increments counter)

Source

pub fn name(&self) -> &str

Source

pub fn vector_dim(&self) -> usize

Source

pub fn distance(&self) -> Distance

Source

pub fn use_hnsw(&self) -> bool

Source

pub fn enable_bm25(&self) -> bool

Source

pub fn count(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn get_all_points(&self) -> Vec<Point>

Get all points in the collection

Source

pub fn upsert(&self, point: Point) -> Result<()>

Insert or update a point

Source

pub fn start_batch(&self)

Start batch insert mode

Source

pub fn end_batch(&self) -> Result<()>

End batch insert mode

Source

pub fn batch_upsert(&self, points: Vec<Point>) -> Result<()>

Batch insert multiple points

Source

pub fn batch_upsert_with_prewarm( &self, points: Vec<Point>, prewarm: bool, ) -> Result<()>

Batch insert with optional pre-warming

Source

pub fn get(&self, id: &str) -> Option<Point>

Get a point by ID

Source

pub fn delete(&self, id: &str) -> Result<bool>

Delete a point by ID

Source

pub fn set_payload(&self, id: &str, payload: Value) -> Result<bool>

Set payload values for a point (merge with existing)

Source

pub fn overwrite_payload(&self, id: &str, payload: Value) -> Result<bool>

Overwrite entire payload for a point

Source

pub fn delete_payload_keys(&self, id: &str, keys: &[String]) -> Result<bool>

Delete specific payload keys from a point

Source

pub fn clear_payload(&self, id: &str) -> Result<bool>

Clear all payload from a point

Source

pub fn update_vector(&self, id: &str, vector: Vector) -> Result<bool>

Update vector for a point

Source

pub fn update_multivector( &self, id: &str, multivector: Option<MultiVector>, ) -> Result<bool>

Update multivector for a point

Source

pub fn delete_vector(&self, id: &str) -> Result<bool>

Delete vector (set to empty) - for named vectors this would delete specific vector

Source

pub fn create_payload_index( &self, field_name: &str, index_type: PayloadIndexType, ) -> Result<bool>

Create a payload field index

Source

pub fn delete_payload_index(&self, field_name: &str) -> Result<bool>

Delete a payload field index

Source

pub fn get_payload_indexes(&self) -> HashMap<String, PayloadIndexType>

Get all payload indexes

Source

pub fn is_field_indexed(&self, field_name: &str) -> bool

Check if a field is indexed

Source

pub fn prewarm_index(&self) -> Result<()>

Pre-warm HNSW index

Source

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

Source

pub fn search_text(&self, query: &str, limit: usize) -> Vec<(String, f32)>

BM25 text search

Source

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.

Source

pub fn iter(&self) -> Vec<Point>

Get all points

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V