pub enum FtsQuery {
Plain {
text: String,
fuzzy: bool,
},
And(Vec<FtsQuery>),
Or(Vec<FtsQuery>),
Not(Box<FtsQuery>),
Phrase(Vec<String>),
Prefix(String),
}Expand description
A structured full-text search query, lowered from PG tsquery syntax.
Variants that require engine support not yet available in nodedb-fts
(Phrase, Not) are represented here but rejected by the executor with
SqlError::Unsupported — they are never silently approximated.
Variants§
Plain
A single search term, optionally with fuzzy matching.
And(Vec<FtsQuery>)
All sub-queries must match (tsquery & / plainto_tsquery space-AND).
Or(Vec<FtsQuery>)
Any sub-query may match (tsquery |).
Not(Box<FtsQuery>)
Excludes documents matching the inner query (tsquery !).
Not yet supported by nodedb-fts; the executor returns
Unsupported when this variant is encountered.
Phrase(Vec<String>)
Strict consecutive-position phrase match (phraseto_tsquery).
Not yet supported by nodedb-fts; the executor returns
Unsupported when this variant is encountered.
Prefix(String)
Prefix search — matches all terms that begin with the given string
(tsquery term:*).
Implementations§
Source§impl FtsQuery
impl FtsQuery
Sourcepub fn as_plain_text(&self) -> Option<&str>
pub fn as_plain_text(&self) -> Option<&str>
Extract the raw query text when the variant is Plain.
Used by the executor to pass the text to nodedb-fts::FtsIndex::search.
Sourcepub fn is_fuzzy(&self) -> bool
pub fn is_fuzzy(&self) -> bool
Return true if fuzzy matching is requested.
Only meaningful for Plain; all other variants return false.
Sourcepub fn to_plain_string(&self) -> Option<String>
pub fn to_plain_string(&self) -> Option<String>
Flatten an And or Or of Plain terms to a space-separated string
suitable for FtsIndex::search. Returns None for structured queries
that cannot be expressed as a plain string.
Trait Implementations§
impl StructuralPartialEq for FtsQuery
Auto Trait Implementations§
impl Freeze for FtsQuery
impl RefUnwindSafe for FtsQuery
impl Send for FtsQuery
impl Sync for FtsQuery
impl Unpin for FtsQuery
impl UnsafeUnpin for FtsQuery
impl UnwindSafe for FtsQuery
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> 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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.