pub struct SearchSession { /* private fields */ }Expand description
Pre-loaded search session: all HNSW indexes loaded into memory once.
Useful for benchmarks and servers that issue many queries against the same snapshot. Avoids re-loading and re-deserializing indexes on every call.
Implementations§
Source§impl SearchSession
impl SearchSession
Sourcepub async fn load(
table: &TableIdent,
vector_column: &str,
dim: u32,
catalog: Arc<dyn CatalogProvider>,
store: Arc<dyn Store>,
load_raw: bool,
) -> AilakeResult<Self>
pub async fn load( table: &TableIdent, vector_column: &str, dim: u32, catalog: Arc<dyn CatalogProvider>, store: Arc<dyn Store>, load_raw: bool, ) -> AilakeResult<Self>
Load all indexes for the latest snapshot into memory.
Pass load_raw = true when reranking will be used (rerank_factor is
Some); it reads the full parquet columns so exact distances are
available without extra I/O during search_query.
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Number of loaded shards.
Sourcepub fn search_batch(
&self,
queries: &[Vec<f32>],
config: &SearchConfig,
) -> Vec<Vec<SearchResult>>
pub fn search_batch( &self, queries: &[Vec<f32>], config: &SearchConfig, ) -> Vec<Vec<SearchResult>>
Search multiple queries in one call.
For shards with raw vectors (Indexing or reranking): dispatches to GPU batch matmul when a CUDA device is available, falling back to CPU flat scan. For indexed shards (HNSW / IVF-PQ): rayon parallel-map over queries — graph traversal is inherently sequential and has no GPU batch path.
Returns one Vec<SearchResult> per input query, in the same order.
Sourcepub fn search_query(
&self,
query: &[f32],
config: &SearchConfig,
) -> Vec<SearchResult>
pub fn search_query( &self, query: &[f32], config: &SearchConfig, ) -> Vec<SearchResult>
Search using pre-loaded indexes. No I/O — pure in-memory search.
Auto Trait Implementations§
impl Freeze for SearchSession
impl RefUnwindSafe for SearchSession
impl Send for SearchSession
impl Sync for SearchSession
impl Unpin for SearchSession
impl UnsafeUnpin for SearchSession
impl UnwindSafe for SearchSession
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
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>
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>
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