pub enum QueryNode {
Vector {
embedding: Vec<f32>,
top_k: usize,
min_score: Option<DeterministicScore>,
},
Keyword {
text: String,
top_k: usize,
min_score: Option<DeterministicScore>,
},
Fuse {
children: Vec<QueryNode>,
strategy: FuseStrategy,
top_k: usize,
},
Filter {
child: Box<QueryNode>,
predicate: FilterPredicate,
},
Rerank {
child: Box<QueryNode>,
method: RerankMethod,
top_k: usize,
},
Empty,
}Expand description
A node in the Query IR tree.
Each variant represents a single retrieval operation or combinator.
Nodes compose recursively – a Fuse holds children, a Filter wraps
a single child, and leaf nodes (Vector, Keyword, Empty) terminate
the tree.
Variants§
Vector
Vector similarity search (e.g. HNSW nearest-neighbor).
Fields
min_score: Option<DeterministicScore>Optional minimum similarity threshold.
Keyword
Keyword / BM25 text search.
Fields
min_score: Option<DeterministicScore>Optional minimum relevance threshold.
Fuse
Fuse multiple sub-queries into a single ranked list.
Fields
strategy: FuseStrategyStrategy for combining ranked lists.
Filter
Filter the results of a sub-query.
Fields
predicate: FilterPredicatePredicate to apply.
Rerank
Rerank the results of a sub-query.
Fields
method: RerankMethodReranking method.
Empty
An empty query that is guaranteed to produce no results.
Useful as the result of constant-folding provably-empty sub-trees.
Implementations§
Source§impl QueryNode
impl QueryNode
Sourcepub fn keyword(text: impl Into<String>, top_k: usize) -> Self
pub fn keyword(text: impl Into<String>, top_k: usize) -> Self
Create a keyword search leaf node.
Sourcepub fn hybrid(
embedding: Vec<f32>,
text: impl Into<String>,
top_k: usize,
) -> Self
pub fn hybrid( embedding: Vec<f32>, text: impl Into<String>, top_k: usize, ) -> Self
Create a hybrid query (vector + keyword with RRF fusion, top_k * 3 candidates each).
Sourcepub fn with_min_score(self, min_score: DeterministicScore) -> Self
pub fn with_min_score(self, min_score: DeterministicScore) -> Self
Wrap this node with a minimum-score filter.
Sourcepub fn with_top_k(self, k: usize) -> Self
pub fn with_top_k(self, k: usize) -> Self
Wrap this node with a top-k truncation filter.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this query is provably empty (no results possible).
A query is provably empty when:
- It is the
Emptyvariant. - A leaf has
top_k == 0. - A keyword leaf has empty text.
- A fuse node has no children.
- A filter/rerank wraps a provably-empty child.
Sourcepub fn leaf_count(&self) -> usize
pub fn leaf_count(&self) -> usize
Count the total number of leaf search operations in the tree.
Vector and Keyword nodes each count as 1. Empty counts as 0.
Combinators recurse into their children.