pub struct RecallQuery {
raw: String,
normalized: String,
required: Vec<String>,
}Expand description
A recall query parsed once into nucleo-style atoms.
Equality is on the raw text: two queries compare equal iff the user typed the same thing, which is what cache keying wants.
Fields§
§raw: String§normalized: String§required: Vec<String>Character runs the DB prefilter requires as ordered subsequences, one per positive atom (operators stripped, escapes resolved, non-ASCII dropped). Negated atoms contribute nothing: LIKE can only require presence, so the fuzzy stage alone enforces absence.
Implementations§
Source§impl RecallQuery
impl RecallQuery
pub fn parse(raw: &str) -> Self
pub fn raw(&self) -> &str
pub fn is_empty(&self) -> bool
Sourcepub fn has_prefilter(&self) -> bool
pub fn has_prefilter(&self) -> bool
Whether this query produces any DB-level prefilter conditions. Queries of only negated/operator atoms don’t, and load identically to no query.
Sourcepub fn like_patterns(&self) -> Vec<String>
pub fn like_patterns(&self) -> Vec<String>
One LIKE pattern per positive atom. “gcm” becomes “%g%c%m%” so it matches “git commit -m”; atoms match in any order because each is an independent AND’d condition, mirroring nucleo’s atom semantics.
Sourcepub fn covers(&self, other: &RecallQuery) -> bool
pub fn covers(&self, other: &RecallQuery) -> bool
Whether a candidate set loaded with self’s prefilter necessarily
contains every row a load with other’s prefilter would return:
each of self’s required runs must be an (ASCII-case-insensitive,
matching LIKE’s NOCASE) subsequence of one of other’s runs, so each
of self’s conditions is implied by one of other’s.
Truncation caveat, shared with a fresh load: both sets keep only the most recent rows within the oversampled window, so “covers” is relative to that window, not the full table.
Sourcepub fn specificity(&self) -> usize
pub fn specificity(&self) -> usize
Total required chars – more chars means a narrower candidate set.
Sourcepub fn scoring_pattern(&self) -> Pattern
pub fn scoring_pattern(&self) -> Pattern
The pattern the fuzzy stage scores with: separators normalized to spaces so matches after them get nucleo’s whitespace-boundary bonus.
Sourcepub fn highlight_pattern(&self) -> Pattern
pub fn highlight_pattern(&self) -> Pattern
The pattern used for highlight indices: the raw query, so “–release” highlights its dashes in the original command text.
Trait Implementations§
Source§impl Clone for RecallQuery
impl Clone for RecallQuery
Source§impl Debug for RecallQuery
impl Debug for RecallQuery
Auto Trait Implementations§
impl Freeze for RecallQuery
impl RefUnwindSafe for RecallQuery
impl Send for RecallQuery
impl Sync for RecallQuery
impl Unpin for RecallQuery
impl UnsafeUnpin for RecallQuery
impl UnwindSafe for RecallQuery
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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