pub enum CandidateSpec<'a> {
ByKey,
Scalar {
field: &'a str,
},
Tokens {
field: &'a str,
},
NumericBucket {
field: &'a str,
tolerance: f64,
},
GeoGrid {
field: &'a str,
km: f64,
},
ScanAll {
field: &'a str,
},
VectorClusters {
field: &'a str,
min: f64,
},
Hnsw {
field: &'a str,
k: usize,
},
Union(Vec<CandidateSpec<'a>>),
Intersect(Vec<CandidateSpec<'a>>),
}Variants§
ByKey
Scalar
Tokens
NumericBucket
GeoGrid
ScanAll
VectorClusters
IVF-Flat approximate candidate selection (legacy; still supported as
direct fallback — no longer the default for approximate: true).
k-means fitted over the indexed side’s vectors; candidates are members
of the P = max(1, ceil(k/16)) nearest centroids to the query vector.
NOT a superset of true positives — recall floor governs correctness.
Hnsw
HNSW approximate candidate selection (default for approximate: true).
Returns the k nearest vectors by cosine similarity from the in-tree
HNSW graph. Falls back to returning all tracked nodes when the graph
has no entry point (e.g. before any node is inserted, or when used
without calling init_hnsw).
Fields
Union(Vec<CandidateSpec<'a>>)
Union of multiple candidate specs, used for Any predicates.
Each branch of the Any predicate contributes its own candidate set
(key index, token index, numeric bucket, etc.); the resulting candidate
set is their union. Insert and remove recurse into every child spec so
the index stays coherent for all branches simultaneously.
Intersect(Vec<CandidateSpec<'a>>)
Intersection of multiple candidate specs, used for All predicates.
Each conjunct contributes its own candidate set; the result is their
intersection (empty child → empty). ScanAll children are skipped at
probe time (they are the universe); if every child is ScanAll, the
spec stays a full scan. Insert/remove recurse into every child.