pub struct Query {
pub all: Vec<String>,
pub any: Vec<Vec<String>>,
pub none: Vec<String>,
pub raw: String,
}Expand description
A parsed search-box query.
Eagle flattens the expression tree into three lists: every AND term must
match, every OR group must have one member match, and no NOT term may
match. Nested groups are flattened the same lossy way, so
dog || (cat black) is the OR of dog and the literal cat black.
Fields§
§all: Vec<String>§any: Vec<Vec<String>>§none: Vec<String>§raw: StringThe whole query, lower-cased; matched as one substring if the terms fail.
Implementations§
Source§impl Query
impl Query
pub fn parse(q: &str) -> Query
pub fn is_empty(&self) -> bool
Sourcepub fn matches(&self, text: &str) -> bool
pub fn matches(&self, text: &str) -> bool
Whether text (already lower-cased) satisfies the query.
Sourcepub fn fuzzy_score(&self, text: &str) -> Option<usize>
pub fn fuzzy_score(&self, text: &str) -> Option<usize>
Typo-tolerant match (falcon’s own, not Eagle’s). Some(0) when
Query::matches passes; otherwise Some(cost), the total number of
edits needed for every AND term and one member of every OR group to
match the start of some word in text, or None if that’s too many.
NOT terms stay exact. See the Search chapter for the rules.
Trait Implementations§
impl StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
Mutably borrows from an owned value. Read more
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,
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> ⓘ
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 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> ⓘ
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().