pub struct MultiVectorStore<E: StorageEngine> { /* private fields */ }Expand description
A store for multi-vector embeddings (ColBERT-style).
MultiVectorStore provides CRUD operations for multi-vector embeddings
organized into named embedding spaces. Each multi-vector stores per-token
embeddings for late interaction models like ColBERT.
Implementations§
Source§impl<E: StorageEngine> MultiVectorStore<E>
impl<E: StorageEngine> MultiVectorStore<E>
Sourcepub const fn new(engine: E) -> Self
pub const fn new(engine: E) -> Self
Create a new multi-vector store with the given storage engine.
Sourcepub fn create_space(
&self,
space: &MultiVectorEmbeddingSpace,
) -> Result<(), VectorError>
pub fn create_space( &self, space: &MultiVectorEmbeddingSpace, ) -> Result<(), VectorError>
Create a new multi-vector embedding space.
§Errors
Returns an error if the space already exists or if the storage operation fails.
Sourcepub fn get_space(
&self,
name: &EmbeddingName,
) -> Result<MultiVectorEmbeddingSpace, VectorError>
pub fn get_space( &self, name: &EmbeddingName, ) -> Result<MultiVectorEmbeddingSpace, VectorError>
Get a multi-vector embedding space by name.
§Errors
Returns an error if the space doesn’t exist or if the storage operation fails.
Sourcepub fn delete_space(&self, name: &EmbeddingName) -> Result<(), VectorError>
pub fn delete_space(&self, name: &EmbeddingName) -> Result<(), VectorError>
Delete a multi-vector embedding space and all its embeddings.
§Errors
Returns an error if the space doesn’t exist or if the storage operation fails.
Sourcepub fn list_spaces(&self) -> Result<Vec<MultiVectorEmbeddingSpace>, VectorError>
pub fn list_spaces(&self) -> Result<Vec<MultiVectorEmbeddingSpace>, VectorError>
Sourcepub fn put(
&self,
entity_id: EntityId,
space_name: &EmbeddingName,
embedding: &MultiVectorEmbedding,
) -> Result<(), VectorError>
pub fn put( &self, entity_id: EntityId, space_name: &EmbeddingName, embedding: &MultiVectorEmbedding, ) -> Result<(), VectorError>
Store a multi-vector embedding for an entity in a space.
§Errors
Returns an error if:
- The embedding space doesn’t exist
- The token embedding dimension doesn’t match the space dimension
- The storage operation fails
Sourcepub fn get(
&self,
entity_id: EntityId,
space_name: &EmbeddingName,
) -> Result<MultiVectorEmbedding, VectorError>
pub fn get( &self, entity_id: EntityId, space_name: &EmbeddingName, ) -> Result<MultiVectorEmbedding, VectorError>
Get a multi-vector embedding for an entity from a space.
§Errors
Returns an error if:
- The embedding space doesn’t exist
- The embedding doesn’t exist for this entity
- The storage operation fails
Sourcepub fn delete(
&self,
entity_id: EntityId,
space_name: &EmbeddingName,
) -> Result<bool, VectorError>
pub fn delete( &self, entity_id: EntityId, space_name: &EmbeddingName, ) -> Result<bool, VectorError>
Sourcepub fn exists(
&self,
entity_id: EntityId,
space_name: &EmbeddingName,
) -> Result<bool, VectorError>
pub fn exists( &self, entity_id: EntityId, space_name: &EmbeddingName, ) -> Result<bool, VectorError>
Check if a multi-vector embedding exists for an entity in a space.
§Errors
Returns an error if the storage operation fails.
Sourcepub fn list_entities(
&self,
space_name: &EmbeddingName,
) -> Result<Vec<EntityId>, VectorError>
pub fn list_entities( &self, space_name: &EmbeddingName, ) -> Result<Vec<EntityId>, VectorError>
List all entity IDs that have multi-vector embeddings in a space.
§Errors
Returns an error if the storage operation fails.
Sourcepub fn count(&self, space_name: &EmbeddingName) -> Result<usize, VectorError>
pub fn count(&self, space_name: &EmbeddingName) -> Result<usize, VectorError>
Count the number of multi-vector embeddings in a space.
§Errors
Returns an error if the storage operation fails.
Sourcepub fn get_many(
&self,
entity_ids: &[EntityId],
space_name: &EmbeddingName,
) -> Result<Vec<(EntityId, Option<MultiVectorEmbedding>)>, VectorError>
pub fn get_many( &self, entity_ids: &[EntityId], space_name: &EmbeddingName, ) -> Result<Vec<(EntityId, Option<MultiVectorEmbedding>)>, VectorError>
Get multiple multi-vector embeddings at once.
Returns a vector of (EntityId, Option<MultiVectorEmbedding>) tuples.
If an embedding doesn’t exist for an entity, the option is None.
§Errors
Returns an error if the storage operation fails.
Sourcepub fn put_many(
&self,
embeddings: &[(EntityId, MultiVectorEmbedding)],
space_name: &EmbeddingName,
) -> Result<(), VectorError>
pub fn put_many( &self, embeddings: &[(EntityId, MultiVectorEmbedding)], space_name: &EmbeddingName, ) -> Result<(), VectorError>
Store multiple multi-vector embeddings at once.
All embeddings must have token dimensions matching the space’s dimension.
§Errors
Returns an error if:
- The embedding space doesn’t exist
- Any embedding dimension doesn’t match the space dimension
- The storage operation fails