Skip to main content

RecallQuery

Struct RecallQuery 

Source
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

Source

pub fn parse(raw: &str) -> Self

Source

pub fn raw(&self) -> &str

Source

pub fn is_empty(&self) -> bool

Source

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.

Source

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.

Source

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.

Source

pub fn specificity(&self) -> usize

Total required chars – more chars means a narrower candidate set.

Source

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.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RecallQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RecallQuery

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.