pub struct VecLite {
pub storage: Storage,
pub metric: Metric,
pub index: Option<HnswIndex>,
}Fields§
§storage: Storage§metric: Metric§index: Option<HnswIndex>Implementations§
Source§impl VecLite
impl VecLite
Sourcepub fn open_with_metric<P>(
path: P,
metric: Metric,
) -> Result<VecLite, VecLiteError>
pub fn open_with_metric<P>( path: P, metric: Metric, ) -> Result<VecLite, VecLiteError>
Open database with specific metric
pub fn enable_hnsw(&mut self, config: HnswConfig)
Sourcepub fn insert(
&mut self,
id: &str,
vector: Vec<f32>,
metadata: Option<Value>,
) -> Result<(), VecLiteError>
pub fn insert( &mut self, id: &str, vector: Vec<f32>, metadata: Option<Value>, ) -> Result<(), VecLiteError>
Insert single vector
Sourcepub fn insert_with_time(
&mut self,
id: &str,
vector: Vec<f32>,
metadata: Option<Value>,
timestamp: Option<u64>,
) -> Result<(), VecLiteError>
pub fn insert_with_time( &mut self, id: &str, vector: Vec<f32>, metadata: Option<Value>, timestamp: Option<u64>, ) -> Result<(), VecLiteError>
Insert vector with time
Sourcepub fn insert_batch(
&mut self,
records: Vec<(&str, Vec<f32>, Option<Value>)>,
) -> Result<(), VecLiteError>
pub fn insert_batch( &mut self, records: Vec<(&str, Vec<f32>, Option<Value>)>, ) -> Result<(), VecLiteError>
Insert multiple vectors
Sourcepub fn search(
&self,
query: &[f32],
k: usize,
) -> Result<Vec<SearchResult>, VecLiteError>
pub fn search( &self, query: &[f32], k: usize, ) -> Result<Vec<SearchResult>, VecLiteError>
Simple search
Sourcepub fn build_search(&self, query: &[f32]) -> SearchBuilder<'_>
pub fn build_search(&self, query: &[f32]) -> SearchBuilder<'_>
Search with filters and decay
Sourcepub fn get(&self, id: &str) -> Option<SearchResult>
pub fn get(&self, id: &str) -> Option<SearchResult>
Retrieve a record by its ID
Source§impl VecLite
impl VecLite
Sourcepub fn delete(&mut self, id: &str) -> Result<(), VecLiteError>
pub fn delete(&mut self, id: &str) -> Result<(), VecLiteError>
Delete a vector by removing it from storage
Sourcepub fn update(
&mut self,
id: &str,
vector: Vec<f32>,
metadata: Option<Value>,
) -> Result<(), VecLiteError>
pub fn update( &mut self, id: &str, vector: Vec<f32>, metadata: Option<Value>, ) -> Result<(), VecLiteError>
Update a vector
Sourcepub fn compact(&mut self) -> Result<(), VecLiteError>
pub fn compact(&mut self) -> Result<(), VecLiteError>
Compact the database
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VecLite
impl !RefUnwindSafe for VecLite
impl Send for VecLite
impl Sync for VecLite
impl Unpin for VecLite
impl UnsafeUnpin for VecLite
impl !UnwindSafe for VecLite
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
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>
Converts
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>
Converts
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 more