pub trait CollectionVectorProvider: Send + Sync {
// Required methods
fn upsert_vector(
&self,
collection_id: CollectionId,
entity_id: EntityId,
collection_name: &str,
vector_name: &str,
data: &VectorData,
) -> Result<(), VectorError>;
fn delete_vector(
&self,
collection_id: CollectionId,
entity_id: EntityId,
collection_name: &str,
vector_name: &str,
) -> Result<bool, VectorError>;
fn delete_entity_vectors(
&self,
collection_id: CollectionId,
entity_id: EntityId,
collection_name: &str,
) -> Result<usize, VectorError>;
fn get_vector(
&self,
collection_id: CollectionId,
entity_id: EntityId,
vector_name: &str,
) -> Result<Option<VectorData>, VectorError>;
fn get_all_vectors(
&self,
collection_id: CollectionId,
entity_id: EntityId,
) -> Result<HashMap<String, VectorData>, VectorError>;
fn search(
&self,
collection_name: &str,
vector_name: &str,
query: &Embedding,
k: usize,
ef_search: Option<usize>,
) -> Result<Vec<SearchResult>, VectorError>;
}Expand description
A trait for providing collection-based vector operations.
This trait allows type-erased access to the separated vector storage
used by collections with named vectors. Unlike VectorIndexProvider which
works with entity-property-based vectors, this trait works with the new
collection-based vector storage architecture.
Required Methods§
Sourcefn upsert_vector(
&self,
collection_id: CollectionId,
entity_id: EntityId,
collection_name: &str,
vector_name: &str,
data: &VectorData,
) -> Result<(), VectorError>
fn upsert_vector( &self, collection_id: CollectionId, entity_id: EntityId, collection_name: &str, vector_name: &str, data: &VectorData, ) -> Result<(), VectorError>
Store a vector for an entity in a collection.
§Arguments
collection_id- The collection IDentity_id- The entity IDcollection_name- The collection name (for index lookup)vector_name- The named vector within the collectiondata- The vector data to store
Sourcefn delete_vector(
&self,
collection_id: CollectionId,
entity_id: EntityId,
collection_name: &str,
vector_name: &str,
) -> Result<bool, VectorError>
fn delete_vector( &self, collection_id: CollectionId, entity_id: EntityId, collection_name: &str, vector_name: &str, ) -> Result<bool, VectorError>
Delete a vector from storage and any associated index.
Sourcefn delete_entity_vectors(
&self,
collection_id: CollectionId,
entity_id: EntityId,
collection_name: &str,
) -> Result<usize, VectorError>
fn delete_entity_vectors( &self, collection_id: CollectionId, entity_id: EntityId, collection_name: &str, ) -> Result<usize, VectorError>
Delete all vectors for an entity in a collection.
Sourcefn get_vector(
&self,
collection_id: CollectionId,
entity_id: EntityId,
vector_name: &str,
) -> Result<Option<VectorData>, VectorError>
fn get_vector( &self, collection_id: CollectionId, entity_id: EntityId, vector_name: &str, ) -> Result<Option<VectorData>, VectorError>
Get a vector from storage.
Sourcefn get_all_vectors(
&self,
collection_id: CollectionId,
entity_id: EntityId,
) -> Result<HashMap<String, VectorData>, VectorError>
fn get_all_vectors( &self, collection_id: CollectionId, entity_id: EntityId, ) -> Result<HashMap<String, VectorData>, VectorError>
Get all vectors for an entity.