pub struct TermDict<'a> { /* private fields */ }Expand description
Read-only term dictionary backed by an FST.
Implementations§
Source§impl<'a> TermDict<'a>
impl<'a> TermDict<'a>
Sourcepub fn get(&self, term: &str) -> Option<u64>
pub fn get(&self, term: &str) -> Option<u64>
Look up a term and return its posting list offset, or None.
Sourcepub fn prefix_iter(&self, prefix: &str) -> Vec<(String, u64)>
pub fn prefix_iter(&self, prefix: &str) -> Vec<(String, u64)>
Collect all terms starting with prefix, returning (term, offset) pairs.
Sourcepub fn automaton_search<A: Automaton>(&self, aut: A) -> Vec<(String, u64)>
pub fn automaton_search<A: Automaton>(&self, aut: A) -> Vec<(String, u64)>
Search the dictionary with an automaton. Returns all matching (term, offset) pairs where the automaton accepts the term.
This is the key optimization for wildcard and fuzzy queries —
the FST is walked in lockstep with the automaton DFA, pruning
entire subtrees where can_match() returns false.
Auto Trait Implementations§
impl<'a> Freeze for TermDict<'a>
impl<'a> RefUnwindSafe for TermDict<'a>
impl<'a> Send for TermDict<'a>
impl<'a> Sync for TermDict<'a>
impl<'a> Unpin for TermDict<'a>
impl<'a> UnsafeUnpin for TermDict<'a>
impl<'a> UnwindSafe for TermDict<'a>
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
Mutably borrows from an owned value. Read more
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