pub struct Collection { /* private fields */ }Implementations§
Source§impl Collection
impl Collection
Sourcepub fn create_and_open(
path: &str,
schema: &CollectionSchema,
options: Option<&CollectionOptions>,
) -> Result<Self>
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.
Sourcepub fn open(path: &str, options: Option<&CollectionOptions>) -> Result<Self>
pub fn open(path: &str, options: Option<&CollectionOptions>) -> Result<Self>
Open an existing collection at path.
Sourcepub fn close(self) -> Result<()>
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.
pub fn schema(&self) -> Result<CollectionSchema>
pub fn options(&self) -> Result<CollectionOptions>
pub fn stats(&self) -> Result<CollectionStats>
pub fn create_index(&self, field_name: &str, params: &IndexParams) -> Result<()>
pub fn drop_index(&self, field_name: &str) -> Result<()>
pub fn add_column( &self, field: &FieldSchema, expression: Option<&str>, ) -> Result<()>
pub fn drop_column(&self, column_name: &str) -> Result<()>
pub fn alter_column( &self, column_name: &str, new_name: Option<&str>, new_schema: Option<&FieldSchema>, ) -> Result<()>
pub fn insert(&self, docs: &[&Doc]) -> Result<WriteSummary>
pub fn insert_with_results(&self, docs: &[&Doc]) -> Result<Vec<WriteResult>>
pub fn update(&self, docs: &[&Doc]) -> Result<WriteSummary>
pub fn update_with_results(&self, docs: &[&Doc]) -> Result<Vec<WriteResult>>
pub fn upsert(&self, docs: &[&Doc]) -> Result<WriteSummary>
pub fn upsert_with_results(&self, docs: &[&Doc]) -> Result<Vec<WriteResult>>
Sourcepub fn insert_iter<I>(&self, docs: I, batch_size: usize) -> Result<WriteSummary>where
I: IntoIterator<Item = Doc>,
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.
Sourcepub fn update_iter<I>(&self, docs: I, batch_size: usize) -> Result<WriteSummary>where
I: IntoIterator<Item = Doc>,
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.
Sourcepub fn upsert_iter<I>(&self, docs: I, batch_size: usize) -> Result<WriteSummary>where
I: IntoIterator<Item = Doc>,
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.
pub fn delete(&self, pks: &[&str]) -> Result<WriteSummary>
pub fn delete_with_results(&self, pks: &[&str]) -> Result<Vec<WriteResult>>
pub fn delete_by_filter(&self, filter: &str) -> Result<()>
pub fn query(&self, query: &VectorQuery) -> Result<DocSet>
pub fn fetch(&self, pks: &[&str]) -> Result<DocSet>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Collection
impl RefUnwindSafe for Collection
impl Unpin for Collection
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more