pub struct SearchProfile { /* private fields */ }Expand description
A composed search behaviour: how text folds, how a query widens, and how the result becomes SQL. A lookup attaches one.
Implementations§
Source§impl SearchProfile
impl SearchProfile
Sourcepub fn folding() -> Self
pub fn folding() -> Self
The standard fold (case, diacritics, punctuation, whitespace).
The fold applies to the query always. It reaches stored values only where
the lookup matches against a folded column; against a raw column a folded
query still misses a stored Ávila, which is what the folded column is
for.
pub fn with_chain(self, chain: NormalizerChain) -> Self
pub fn with_expander(self, expander: impl QueryExpander) -> Self
Sourcepub fn with_matcher(self, matcher: impl Matcher) -> Self
pub fn with_matcher(self, matcher: impl Matcher) -> Self
Adds a matcher ahead of the default, for Self::matcher to pick when
the deployment supports it.
pub fn chain(&self) -> &NormalizerChain
pub fn fold(&self, text: &str) -> String
Sourcepub fn candidates(&self, q: &str) -> Vec<String>
pub fn candidates(&self, q: &str) -> Vec<String>
The terms to match: the folded query plus its expansions, escaped for
LIKE and capped at MAX_CANDIDATES. Empty when the query folds away
to nothing, which a caller reads as “match nothing”.
Sourcepub fn matcher(&self, caps: &CapabilitySet) -> &dyn Matcher
pub fn matcher(&self, caps: &CapabilitySet) -> &dyn Matcher
The first matcher this deployment supports, falling back to LIKE. A
matcher that cannot run is skipped, never an error, so one profile works
on all three databases.
Sourcepub fn condition(
&self,
caps: &CapabilitySet,
column: &str,
q: &str,
) -> Option<Condition>
pub fn condition( &self, caps: &CapabilitySet, column: &str, q: &str, ) -> Option<Condition>
The condition matching q against column.
None means the query carried no terms (it was blank, or folded away to
nothing). What that means is the caller’s to decide: a lookup that opens
as a dropdown adds no clause and lists the first rows, which is the usual
reading. It is never “match nothing” here.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SearchProfile
impl !UnwindSafe for SearchProfile
impl Freeze for SearchProfile
impl Send for SearchProfile
impl Sync for SearchProfile
impl Unpin for SearchProfile
impl UnsafeUnpin for SearchProfile
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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