CollectionVectorProvider

Trait CollectionVectorProvider 

Source
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§

Source

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 ID
  • entity_id - The entity ID
  • collection_name - The collection name (for index lookup)
  • vector_name - The named vector within the collection
  • data - The vector data to store
Source

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.

Source

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.

Source

fn get_vector( &self, collection_id: CollectionId, entity_id: EntityId, vector_name: &str, ) -> Result<Option<VectorData>, VectorError>

Get a vector from storage.

Source

fn get_all_vectors( &self, collection_id: CollectionId, entity_id: EntityId, ) -> Result<HashMap<String, VectorData>, VectorError>

Get all vectors for an entity.

Source

fn search( &self, collection_name: &str, vector_name: &str, query: &Embedding, k: usize, ef_search: Option<usize>, ) -> Result<Vec<SearchResult>, VectorError>

Search for similar vectors using HNSW (if index exists).

Implementors§