pub struct SearchConfig {
pub top_k: usize,
pub ef_search: usize,
pub pruning_threshold: f32,
pub rerank_factor: Option<usize>,
pub hybrid: Option<HybridConfig>,
pub score_fn: Option<ScoreFn>,
pub partition_filter: Option<String>,
}Fields§
§top_k: usize§ef_search: usize§pruning_threshold: f32Maximum distance from query to file centroid edge for a file to be searched.
Files where distance(query, centroid) - radius > pruning_threshold are skipped.
Set to f32::INFINITY to disable pruning (scan all files).
rerank_factor: Option<usize>When Some(factor), fetch top_k * factor candidates from the HNSW index and
rerank them using exact F32 distances before truncating to top_k.
Corrects the approximation error introduced by PQ-compressed HNSW distances.
None (default) disables reranking.
hybrid: Option<HybridConfig>Hybrid BM25+vector search configuration.
When set, the pipeline loads global IDF stats from the table’s BM25 stats file,
fetches a larger candidate pool from HNSW (candidate_pool or 10 * top_k),
scores each candidate with BM25 against query_text, then fuses vector distance
and BM25 score via RRF (default) or linear combination.
The BM25 stats file (metadata/ailake_bm25_stats.bin) is populated automatically
by TableWriter when bm25_text_column is configured. If absent, pure vector
distances are used (BM25 scores default to 0).
score_fn: Option<ScoreFn>Optional scoring function for hybrid ranking.
When set, the search pipeline reads the Parquet row for each HNSW
candidate and calls score_fn(distance, &single_row_batch). The
returned value replaces distance in SearchResult and determines
final ranking (lower = better).
If rerank_factor is also set, score_fn receives the exact
(non-approximated) distance from the reranking step.
Use ScoreFn::new(|d, row| ...) to construct. See ScoreFn docs
for an example using hybrid_score with episodic memory columns.
partition_filter: Option<String>Partition filter: only search files whose DataFileEntry::partition_value
matches this string. None searches all files (no partition pruning).
Set to agent_id in Agent.recall() for per-agent isolated search.
Implementations§
Source§impl SearchConfig
impl SearchConfig
pub fn with_pruning(self, threshold: f32) -> Self
pub fn with_reranking(self, factor: usize) -> Self
pub fn with_score_fn( self, f: impl Fn(f32, &RecordBatch) -> f32 + Send + Sync + 'static, ) -> Self
pub fn with_hybrid(self, cfg: HybridConfig) -> Self
Trait Implementations§
Source§impl Clone for SearchConfig
impl Clone for SearchConfig
Source§fn clone(&self) -> SearchConfig
fn clone(&self) -> SearchConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SearchConfig
impl Debug for SearchConfig
Auto Trait Implementations§
impl !RefUnwindSafe for SearchConfig
impl !UnwindSafe for SearchConfig
impl Freeze for SearchConfig
impl Send for SearchConfig
impl Sync for SearchConfig
impl Unpin for SearchConfig
impl UnsafeUnpin for SearchConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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