pub struct VectorEngine {
pub config: VectorConfig,
pub collections: Arc<CollectionManager>,
pub ann_searcher: Arc<AnnSearcher>,
pub hybrid_searcher: Arc<HybridSearcher>,
pub embedding_client: Arc<dyn EmbeddingProvider>,
}Expand description
High-level engine that manages collections, search, and embeddings.
Fields§
§config: VectorConfigRuntime configuration.
collections: Arc<CollectionManager>Collection lifecycle and persistence manager.
ann_searcher: Arc<AnnSearcher>ANN search service.
hybrid_searcher: Arc<HybridSearcher>Hybrid vector + keyword search service.
embedding_client: Arc<dyn EmbeddingProvider>Embedding provider used for text ingestion and search.
Implementations§
Source§impl VectorEngine
impl VectorEngine
Sourcepub async fn new(config: VectorConfig) -> VectorResult<Self>
pub async fn new(config: VectorConfig) -> VectorResult<Self>
Create a new engine using the configured gRPC embedding service.
Sourcepub async fn open_default() -> VectorResult<Self>
pub async fn open_default() -> VectorResult<Self>
Open an engine using the default configuration.
Sourcepub async fn with_embedding_provider(
config: VectorConfig,
embedding_client: Arc<dyn EmbeddingProvider>,
) -> VectorResult<Self>
pub async fn with_embedding_provider( config: VectorConfig, embedding_client: Arc<dyn EmbeddingProvider>, ) -> VectorResult<Self>
Create a new engine with a caller-supplied embedding provider.
Sourcepub async fn create_collection(
&self,
name: &str,
dimensions: usize,
distance: DistanceMetric,
) -> VectorResult<Collection>
pub async fn create_collection( &self, name: &str, dimensions: usize, distance: DistanceMetric, ) -> VectorResult<Collection>
Create a collection with the provided dimensions and distance metric.
Sourcepub async fn create_collection_in_workspace(
&self,
workspace_id: &str,
name: &str,
dimensions: usize,
distance: DistanceMetric,
) -> VectorResult<Collection>
pub async fn create_collection_in_workspace( &self, workspace_id: &str, name: &str, dimensions: usize, distance: DistanceMetric, ) -> VectorResult<Collection>
Create a collection inside a specific workspace.
Sourcepub async fn delete_collection(&self, name: &str) -> VectorResult<()>
pub async fn delete_collection(&self, name: &str) -> VectorResult<()>
Delete a collection and all of its persisted state.
Sourcepub async fn delete_collection_in_workspace(
&self,
workspace_id: &str,
name: &str,
) -> VectorResult<()>
pub async fn delete_collection_in_workspace( &self, workspace_id: &str, name: &str, ) -> VectorResult<()>
Delete a collection inside a specific workspace.
Sourcepub async fn list_collections(&self) -> VectorResult<Vec<Collection>>
pub async fn list_collections(&self) -> VectorResult<Vec<Collection>>
List all collections.
Sourcepub async fn list_collections_in_workspace(
&self,
workspace_id: &str,
) -> VectorResult<Vec<Collection>>
pub async fn list_collections_in_workspace( &self, workspace_id: &str, ) -> VectorResult<Vec<Collection>>
List collections scoped to a workspace.
Sourcepub async fn upsert(
&self,
collection: &str,
text: &str,
metadata: Value,
) -> VectorResult<Uuid>
pub async fn upsert( &self, collection: &str, text: &str, metadata: Value, ) -> VectorResult<Uuid>
Embed text, persist the record, and return its UUID.
Sourcepub async fn upsert_in_workspace(
&self,
workspace_id: &str,
collection: &str,
text: &str,
metadata: Value,
) -> VectorResult<Uuid>
pub async fn upsert_in_workspace( &self, workspace_id: &str, collection: &str, text: &str, metadata: Value, ) -> VectorResult<Uuid>
Embed and insert a record in a workspace-scoped collection.
Sourcepub async fn upsert_batch(
&self,
collection: &str,
items: Vec<(String, Value)>,
) -> VectorResult<Vec<Uuid>>
pub async fn upsert_batch( &self, collection: &str, items: Vec<(String, Value)>, ) -> VectorResult<Vec<Uuid>>
Embed and insert multiple text records.
Sourcepub async fn upsert_batch_in_workspace(
&self,
workspace_id: &str,
collection: &str,
items: Vec<(String, Value)>,
) -> VectorResult<Vec<Uuid>>
pub async fn upsert_batch_in_workspace( &self, workspace_id: &str, collection: &str, items: Vec<(String, Value)>, ) -> VectorResult<Vec<Uuid>>
Embed and insert multiple records in a workspace-scoped collection.
Sourcepub async fn upsert_vector(
&self,
collection: &str,
vector: Vec<f32>,
metadata: Value,
) -> VectorResult<Uuid>
pub async fn upsert_vector( &self, collection: &str, vector: Vec<f32>, metadata: Value, ) -> VectorResult<Uuid>
Insert a raw vector directly.
Sourcepub async fn upsert_vector_in_workspace(
&self,
workspace_id: &str,
collection: &str,
vector: Vec<f32>,
metadata: Value,
) -> VectorResult<Uuid>
pub async fn upsert_vector_in_workspace( &self, workspace_id: &str, collection: &str, vector: Vec<f32>, metadata: Value, ) -> VectorResult<Uuid>
Insert a raw vector directly into a workspace-scoped collection.
Sourcepub async fn search(&self, query: SearchQuery) -> VectorResult<SearchResponse>
pub async fn search(&self, query: SearchQuery) -> VectorResult<SearchResponse>
Execute ANN search.
Sourcepub async fn search_in_workspace(
&self,
workspace_id: &str,
query: SearchQuery,
) -> VectorResult<SearchResponse>
pub async fn search_in_workspace( &self, workspace_id: &str, query: SearchQuery, ) -> VectorResult<SearchResponse>
Execute ANN search scoped to a workspace.
Sourcepub async fn search_text(
&self,
collection: &str,
text: &str,
top_k: usize,
) -> VectorResult<SearchResponse>
pub async fn search_text( &self, collection: &str, text: &str, top_k: usize, ) -> VectorResult<SearchResponse>
Execute ANN search from raw text.
Sourcepub async fn search_text_in_workspace(
&self,
workspace_id: &str,
collection: &str,
text: &str,
top_k: usize,
) -> VectorResult<SearchResponse>
pub async fn search_text_in_workspace( &self, workspace_id: &str, collection: &str, text: &str, top_k: usize, ) -> VectorResult<SearchResponse>
Execute ANN search from raw text scoped to a workspace.
Sourcepub async fn hybrid_search(
&self,
query: HybridQuery,
) -> VectorResult<SearchResponse>
pub async fn hybrid_search( &self, query: HybridQuery, ) -> VectorResult<SearchResponse>
Execute hybrid search.
Sourcepub async fn delete(&self, collection: &str, id: Uuid) -> VectorResult<bool>
pub async fn delete(&self, collection: &str, id: Uuid) -> VectorResult<bool>
Delete a vector record by UUID.
Sourcepub async fn delete_in_workspace(
&self,
workspace_id: &str,
collection: &str,
id: Uuid,
) -> VectorResult<bool>
pub async fn delete_in_workspace( &self, workspace_id: &str, collection: &str, id: Uuid, ) -> VectorResult<bool>
Delete a vector by UUID from a workspace-scoped collection.
Sourcepub async fn get(
&self,
collection: &str,
id: Uuid,
) -> VectorResult<VectorRecord>
pub async fn get( &self, collection: &str, id: Uuid, ) -> VectorResult<VectorRecord>
Fetch a vector record by UUID.
Sourcepub async fn get_in_workspace(
&self,
workspace_id: &str,
collection: &str,
id: Uuid,
) -> VectorResult<VectorRecord>
pub async fn get_in_workspace( &self, workspace_id: &str, collection: &str, id: Uuid, ) -> VectorResult<VectorRecord>
Fetch a vector by UUID from a workspace-scoped collection.
Sourcepub async fn close(&self) -> VectorResult<()>
pub async fn close(&self) -> VectorResult<()>
Persist indexes and close the underlying store.
Sourcepub async fn stats(&self) -> EngineStats
pub async fn stats(&self) -> EngineStats
Return runtime statistics for the engine.
Auto Trait Implementations§
impl Freeze for VectorEngine
impl !RefUnwindSafe for VectorEngine
impl Send for VectorEngine
impl Sync for VectorEngine
impl Unpin for VectorEngine
impl UnsafeUnpin for VectorEngine
impl !UnwindSafe for VectorEngine
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request