pub struct Collection { /* private fields */ }Expand description
Cheap, cloneable, thread-safe handle to one collection.
Implementations§
Source§impl Collection
impl Collection
pub fn create_index(&self, field_name: &str, params: &IndexParams) -> Result<()>
pub fn drop_index(&self, field_name: &str) -> Result<()>
pub fn optimize(&self) -> Result<()>
Sourcepub fn rebuild_index(&self, field_name: &str) -> Result<()>
pub fn rebuild_index(&self, field_name: &str) -> Result<()>
Rebuilds one configured in-memory index generation.
Source§impl Collection
impl Collection
Sourcepub fn start_maintenance(
&self,
options: CollectionMaintenanceOptions,
) -> Result<CollectionMaintenanceRuntime>
pub fn start_maintenance( &self, options: CollectionMaintenanceOptions, ) -> Result<CollectionMaintenanceRuntime>
Starts the collection’s single explicitly owned background scheduler.
The worker is opt-in and uses only standard threads. Each due run rebuilds the complete derived index registry and checkpoints the same authoritative revision. Read-only and closed collections reject it.
Source§impl Collection
impl Collection
pub fn insert(&self, docs: &[&Doc]) -> Result<WriteResult>
pub fn update(&self, docs: &[&Doc]) -> Result<WriteResult>
pub fn upsert(&self, docs: &[&Doc]) -> Result<WriteResult>
pub fn delete(&self, pks: &[&str]) -> Result<WriteResult>
pub fn delete_by_filter(&self, filter: &str) -> Result<()>
Source§impl Collection
impl Collection
pub fn query(&self, query: &SearchQuery) -> Result<Vec<Doc>>
pub fn multi_query(&self, query: &MultiQuery) -> Result<Vec<Doc>>
pub fn group_by( &self, query: &GroupBySearchQuery, ) -> Result<HashMap<String, Vec<Doc>>>
pub fn group_by_query( &self, query: &GroupBySearchQuery, ) -> Result<HashMap<String, Vec<Doc>>>
pub fn fetch(&self, pks: &[&str]) -> Result<Vec<Doc>>
pub fn fetch_with_options( &self, pks: &[&str], output_fields: Option<&[&str]>, include_vector: bool, ) -> Result<Vec<Doc>>
pub fn iter(&self) -> Result<DocIterator>
pub fn iter_with_options( &self, output_fields: Option<&[&str]>, include_vector: bool, ) -> Result<DocIterator>
Source§impl Collection
impl Collection
Sourcepub async fn query_async(&self, query: &SearchQuery) -> Result<Vec<Doc>>
pub async fn query_async(&self, query: &SearchQuery) -> Result<Vec<Doc>>
Executes a query on Tokio’s blocking pool.
This keeps positioned DiskANN reads and exact refinement off async
runtime worker threads. The query still uses the same synchronous
snapshot, planner, fallback, scoring, and telemetry path as Self::query.
Once scheduled, dropping the returned future does not cancel the
blocking query.
Sourcepub async fn multi_query_async(&self, query: &MultiQuery) -> Result<Vec<Doc>>
pub async fn multi_query_async(&self, query: &MultiQuery) -> Result<Vec<Doc>>
Executes every multi-query branch on Tokio’s blocking pool.
The full fusion operation runs in one blocking task so all branches use
the same captured collection snapshot as Self::multi_query.
Once scheduled, dropping the returned future does not cancel the task.
Sourcepub async fn group_by_async(
&self,
query: &GroupBySearchQuery,
) -> Result<HashMap<String, Vec<Doc>>>
pub async fn group_by_async( &self, query: &GroupBySearchQuery, ) -> Result<HashMap<String, Vec<Doc>>>
Executes a grouped vector query on Tokio’s blocking pool.
Once scheduled, dropping the returned future does not cancel the task.
Source§impl Collection
impl Collection
pub fn create_and_open( path: &str, schema: &CollectionSchema, options: Option<&CollectionOptions>, ) -> Result<Self>
pub fn create( path: &str, schema: &CollectionSchema, options: Option<&CollectionOptions>, ) -> Result<Self>
pub fn open(path: &str, options: Option<&CollectionOptions>) -> Result<Self>
pub fn path(&self) -> PathBuf
pub fn is_open(&self) -> bool
pub fn flush(&self) -> Result<()>
pub fn close(self) -> Result<()>
pub fn destroy(self) -> Result<()>
pub fn schema(&self) -> Result<CollectionSchema>
pub fn stats(&self) -> Result<CollectionStats>
Sourcepub fn health(&self) -> Result<CollectionHealth>
pub fn health(&self) -> Result<CollectionHealth>
Assesses authoritative revision agreement and derived-index readiness.
A pending WAL is reported but remains healthy because interval/manual durability intentionally permits checkpoint lag. Unlike other data methods, health remains observable after the shared handle is closed.
pub fn stats_snapshot(&self) -> Result<StatsSnapshot>
pub fn count(&self) -> Result<usize>
pub fn add_column( &self, field_schema: &FieldSchema, default_expr: Option<&str>, ) -> Result<()>
pub fn add_column_with_options( &self, field_schema: &FieldSchema, default_expr: Option<&str>, option: AddColumnOption, ) -> Result<()>
pub fn drop_column(&self, name: &str) -> Result<()>
pub fn rename_column(&self, old_name: &str, new_name: &str) -> Result<()>
pub fn alter_column( &self, field_schema: &FieldSchema, option: AlterColumnOption, ) -> Result<()>
Trait Implementations§
Source§impl Clone for Collection
impl Clone for Collection
Auto Trait Implementations§
impl Freeze for Collection
impl RefUnwindSafe for Collection
impl Send for Collection
impl Sync 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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