Struct tantivy::query::PhrasePrefixQuery
source · pub struct PhrasePrefixQuery { /* private fields */ }
Expand description
PhrasePrefixQuery
matches a specific sequence of words followed by term of which only a
prefix is known.
For instance the phrase prefix query for "part t"
will match
the sentence
Alan just got a part time job.
On the other hand it will not match the sentence.
This is my favorite part of the job.
Using a PhrasePrefixQuery
on a field requires positions
to be indexed for this field.
Implementations§
source§impl PhrasePrefixQuery
impl PhrasePrefixQuery
sourcepub fn new(terms: Vec<Term>) -> PhrasePrefixQuery
pub fn new(terms: Vec<Term>) -> PhrasePrefixQuery
Creates a new PhrasePrefixQuery
given a list of terms.
There must be at least two terms, and all terms must belong to the same field. Offset for each term will be same as index in the Vector The last Term is a prefix and not a full value
sourcepub fn new_with_offset(terms: Vec<(usize, Term)>) -> PhrasePrefixQuery
pub fn new_with_offset(terms: Vec<(usize, Term)>) -> PhrasePrefixQuery
Creates a new PhrasePrefixQuery
given a list of terms and their offsets.
Can be used to provide custom offset for each term.
sourcepub fn set_max_expansions(&mut self, value: u32)
pub fn set_max_expansions(&mut self, value: u32)
Maximum number of terms to which the last provided term will expand.
sourcepub fn phrase_terms(&self) -> Vec<Term>
pub fn phrase_terms(&self) -> Vec<Term>
Term
s in the phrase without the associated offsets.
Trait Implementations§
source§impl Clone for PhrasePrefixQuery
impl Clone for PhrasePrefixQuery
source§fn clone(&self) -> PhrasePrefixQuery
fn clone(&self) -> PhrasePrefixQuery
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PhrasePrefixQuery
impl Debug for PhrasePrefixQuery
source§impl Query for PhrasePrefixQuery
impl Query for PhrasePrefixQuery
source§fn weight(&self, enable_scoring: EnableScoring<'_>) -> Result<Box<dyn Weight>>
fn weight(&self, enable_scoring: EnableScoring<'_>) -> Result<Box<dyn Weight>>
Create the weight associated with a query.
See Weight
.
source§fn query_terms<'a>(&'a self, visitor: &mut dyn FnMut(&'a Term, bool))
fn query_terms<'a>(&'a self, visitor: &mut dyn FnMut(&'a Term, bool))
source§fn explain(
&self,
searcher: &Searcher,
doc_address: DocAddress
) -> Result<Explanation>
fn explain( &self, searcher: &Searcher, doc_address: DocAddress ) -> Result<Explanation>
Explanation
for the score of the document.Auto Trait Implementations§
impl Freeze for PhrasePrefixQuery
impl RefUnwindSafe for PhrasePrefixQuery
impl Send for PhrasePrefixQuery
impl Sync for PhrasePrefixQuery
impl Unpin for PhrasePrefixQuery
impl UnwindSafe for PhrasePrefixQuery
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.