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 name(&self) -> &str

Source

pub fn vector_dim(&self) -> usize

Source

pub fn distance(&self) -> Distance

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 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 iter(&self) -> Vec<Point>

Get all points

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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