Skip to main content

Collection

Struct Collection 

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

Implementations§

Source§

impl Collection

Source

pub fn create_and_open( path: &str, schema: &CollectionSchema, options: Option<&CollectionOptions>, ) -> Result<Self>

Create (and open) a new collection at path using the given schema. Passing None for options uses zvec’s defaults.

Source

pub fn open(path: &str, options: Option<&CollectionOptions>) -> Result<Self>

Open an existing collection at path.

Source

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

Flush buffered writes to disk.

Source

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

Rebuild indexes and merge segments.

Source

pub fn close(self) -> Result<()>

Close the underlying handle. After this the collection cannot be used. Normally closing happens in Drop, but callers may want an explicit close to check the result.

Source

pub fn schema(&self) -> Result<CollectionSchema>

Source

pub fn options(&self) -> Result<CollectionOptions>

Source

pub fn stats(&self) -> Result<CollectionStats>

Source

pub fn create_index(&self, field_name: &str, params: &IndexParams) -> Result<()>

Source

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

Source

pub fn add_column( &self, field: &FieldSchema, expression: Option<&str>, ) -> Result<()>

Source

pub fn drop_column(&self, column_name: &str) -> Result<()>

Source

pub fn alter_column( &self, column_name: &str, new_name: Option<&str>, new_schema: Option<&FieldSchema>, ) -> Result<()>

Source

pub fn insert(&self, docs: &[&Doc]) -> Result<WriteSummary>

Source

pub fn insert_with_results(&self, docs: &[&Doc]) -> Result<Vec<WriteResult>>

Source

pub fn update(&self, docs: &[&Doc]) -> Result<WriteSummary>

Source

pub fn update_with_results(&self, docs: &[&Doc]) -> Result<Vec<WriteResult>>

Source

pub fn upsert(&self, docs: &[&Doc]) -> Result<WriteSummary>

Source

pub fn upsert_with_results(&self, docs: &[&Doc]) -> Result<Vec<WriteResult>>

Source

pub fn insert_iter<I>(&self, docs: I, batch_size: usize) -> Result<WriteSummary>
where I: IntoIterator<Item = Doc>,

Stream Docs from an iterator into the collection in batches of batch_size. Accumulates per-batch WriteSummarys into a single returned summary; stops on the first error.

Useful for loading large corpora where collecting every Doc into a Vec up front would be wasteful or impossible.

Source

pub fn update_iter<I>(&self, docs: I, batch_size: usize) -> Result<WriteSummary>
where I: IntoIterator<Item = Doc>,

As Self::insert_iter but using Self::update for each batch.

Source

pub fn upsert_iter<I>(&self, docs: I, batch_size: usize) -> Result<WriteSummary>
where I: IntoIterator<Item = Doc>,

As Self::insert_iter but using Self::upsert for each batch.

Source

pub fn delete(&self, pks: &[&str]) -> Result<WriteSummary>

Source

pub fn delete_with_results(&self, pks: &[&str]) -> Result<Vec<WriteResult>>

Source

pub fn delete_by_filter(&self, filter: &str) -> Result<()>

Source

pub fn query(&self, query: &VectorQuery) -> Result<DocSet>

Source

pub fn fetch(&self, pks: &[&str]) -> Result<DocSet>

Trait Implementations§

Source§

impl Drop for Collection

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Collection

Source§

impl Sync for Collection

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, 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.