pub struct VectorStore<S: Storage> { /* private fields */ }Expand description
Persistent vector store that saves collections to disk
Implementations§
Source§impl<S: Storage> VectorStore<S>
impl<S: Storage> VectorStore<S>
pub fn new(storage: S) -> Self
Sourcepub fn create_collection(
&mut self,
name: &str,
dimension: usize,
metric: DistanceMetric,
) -> Result<()>
pub fn create_collection( &mut self, name: &str, dimension: usize, metric: DistanceMetric, ) -> Result<()>
Create a new vector collection
Sourcepub fn get_collection(&mut self, name: &str) -> Result<VectorCollection>
pub fn get_collection(&mut self, name: &str) -> Result<VectorCollection>
Get a vector collection, loading from disk if not cached
Sourcepub fn save_collection(&mut self, collection: VectorCollection) -> Result<()>
pub fn save_collection(&mut self, collection: VectorCollection) -> Result<()>
Save a collection to disk and cache
Sourcepub fn add_vector(
&mut self,
collection_name: &str,
vector: Vector,
) -> Result<()>
pub fn add_vector( &mut self, collection_name: &str, vector: Vector, ) -> Result<()>
Add a vector to a collection
Sourcepub fn search(
&mut self,
collection_name: &str,
query: &[f32],
k: usize,
) -> Result<Vec<SearchResult>>
pub fn search( &mut self, collection_name: &str, query: &[f32], k: usize, ) -> Result<Vec<SearchResult>>
Search for similar vectors in a collection
Sourcepub fn list_collections(&self) -> Result<Vec<String>>
pub fn list_collections(&self) -> Result<Vec<String>>
List all collection names
Sourcepub fn delete_collection(&mut self, name: &str) -> Result<()>
pub fn delete_collection(&mut self, name: &str) -> Result<()>
Delete a collection
Auto Trait Implementations§
impl<S> Freeze for VectorStore<S>where
S: Freeze,
impl<S> RefUnwindSafe for VectorStore<S>where
S: RefUnwindSafe,
impl<S> Send for VectorStore<S>
impl<S> Sync for VectorStore<S>
impl<S> Unpin for VectorStore<S>where
S: Unpin,
impl<S> UnwindSafe for VectorStore<S>where
S: UnwindSafe,
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
Mutably borrows from an owned value. Read more