pub struct SparseQueryConfig {
pub tokenizer: Option<String>,
pub weighting: QueryWeighting,
pub heap_factor: f32,
pub weight_threshold: f32,
pub max_query_dims: Option<usize>,
pub pruning: Option<f32>,
pub min_query_dims: usize,
pub lsp_gamma: Option<usize>,
}Expand description
Query-time configuration for sparse vectors
Quality-sensitive query optimization knobs. Weight filtering, dimension caps, fractional pruning, finite LSP gamma, and heap factors below 1.0 can all change the candidate set. They are disabled by default and should be tuned against representative Recall@K or relevance judgments.
Fields§
§tokenizer: Option<String>HuggingFace tokenizer path/name for query-time tokenization Example: “Alibaba-NLP/gte-Qwen2-1.5B-instruct”
weighting: QueryWeightingWeighting strategy for tokenized query terms
heap_factor: f32Heap factor for approximate search (SEISMIC-style optimization) A block is skipped if its max possible score < heap_factor * threshold
- 1.0 = exact search (default)
- values below 1.0 = increasingly aggressive block pruning
weight_threshold: f32Minimum weight for query dimensions (query-time pruning) Dimensions with abs(weight) below this threshold are dropped before search. Useful for filtering low-IDF tokens that add latency without improving relevance.
- 0.0 = no filtering (default)
- positive values drop dimensions and require quality validation
max_query_dims: Option<usize>Maximum number of query dimensions to process (query pruning) Processes only the top-k dimensions by weight
- None = process all dimensions (default, exact)
- Some(k) = process only the top-k dimensions by absolute weight
pruning: Option<f32>Fraction of query dimensions to keep (0.0-1.0), same semantics as
indexing-time pruning: sort by abs(weight) descending and keep the
top fraction. BMP uses this subset for candidate generation and the
bounded full query for final scoring; MaxScore uses the subset for both.
None or 1.0 = no pruning.
min_query_dims: usizeMinimum number of query dimensions before pruning and weight_threshold filtering are applied. Protects short queries from losing most signal.
Default: 4. Set to 0 to always apply pruning/filtering.
lsp_gamma: Option<usize>LSP/0 top-superblock guarantee γ. None selects the paper-derived
schedule from retrieval depth; Some(0) requests exhaustive traversal.
Trait Implementations§
Source§impl Clone for SparseQueryConfig
impl Clone for SparseQueryConfig
Source§fn clone(&self) -> SparseQueryConfig
fn clone(&self) -> SparseQueryConfig
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 SparseQueryConfig
impl Debug for SparseQueryConfig
Source§impl Default for SparseQueryConfig
impl Default for SparseQueryConfig
Source§impl<'de> Deserialize<'de> for SparseQueryConfig
impl<'de> Deserialize<'de> for SparseQueryConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SparseQueryConfig
impl PartialEq for SparseQueryConfig
Source§impl Serialize for SparseQueryConfig
impl Serialize for SparseQueryConfig
impl StructuralPartialEq for SparseQueryConfig
Auto Trait Implementations§
impl Freeze for SparseQueryConfig
impl RefUnwindSafe for SparseQueryConfig
impl Send for SparseQueryConfig
impl Sync for SparseQueryConfig
impl Unpin for SparseQueryConfig
impl UnsafeUnpin for SparseQueryConfig
impl UnwindSafe for SparseQueryConfig
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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