pub trait VectorDbRead {
// Required methods
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 Query,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn search_with_nprobe<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 Query,
nprobe: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vector>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Trait for querying the vector db
Required Methods§
Sourcefn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 Query,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 Query,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search for k-nearest neighbors to a query vector.
This implements the SPANN-style query algorithm:
- Search HNSW for nearest centroids
- Load posting lists for those centroids
- Filter deleted vectors
- Score candidates and return top-k
§Arguments
query- search query
§Returns
Vector of SearchResults sorted by similarity (best first)
§Errors
Returns an error if:
- Query dimensions don’t match collection dimensions
- Storage read fails
fn search_with_nprobe<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 Query,
nprobe: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vector>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vector>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a vector record by its external ID.
This is a point lookup operation that retrieves a single record with all its fields.
Returns None if the record doesn’t exist or has been deleted.
§Arguments
id- External ID of the record to retrieve
§Returns
Some(VectorRecord) if found, None if not found or deleted.