QueryParser

Struct QueryParser 

Source
pub struct QueryParser(/* private fields */);
Expand description

A type for building Query objects from strings

Implementations§

Source§

impl QueryParser

Source

pub fn add_prefix<T>( &mut self, field: impl AsRef<str>, prefix: impl Into<Option<T>>, )
where T: AsRef<str> + Default,

Add a free-text field term prefix

Source

pub fn add_custom_prefix<T: FieldProcessor + Clone + 'static>( &mut self, field: impl AsRef<str>, field_proc: T, )

Add a free-text field term prefix backed by a custom FieldProcessor

Source

pub fn add_custom_boolean_prefix<T, U>( &mut self, field: impl AsRef<str>, field_proc: T, grouping: impl Into<Option<U>>, )
where T: FieldProcessor + Clone + 'static, U: AsRef<str>,

Register a FieldProcessor for a boolean prefix

Source

pub fn add_boolean_prefix<T, U>( &mut self, field: impl AsRef<str>, prefix: impl Into<Option<T>>, grouping: impl Into<Option<U>>, )
where T: AsRef<str> + Default, U: AsRef<str> + Default,

Add a boolean term prefix, allowing the user to restrict a search with a boolean filter specified in the free text query

Source

pub fn add_rangeprocessor<'g>( &mut self, marker: impl Into<String>, slot: impl Into<Slot>, range_proc: impl RangeProcessor + 'static, is_suffix: bool, can_repeat: bool, grouping: impl Into<Option<&'g str>>, )

Register a RangeProcessor

Source

pub fn set_stemmer(&mut self, stemmer: impl AsRef<Stem>)

Set the Stem to be used with this QueryParser

Source

pub fn set_stemming_strategy( &mut self, strategy: impl Into<QueryParser_stem_strategy>, )

Set the StemStrategy

Source

pub fn set_stopper<T: Stopper + 'static>( &mut self, stopper: impl Into<Option<T>>, )

Set the Stopper to be used with this QueryParser

Source

pub fn parse_query<T>( &mut self, query: impl AsRef<str>, flags: impl Into<Option<QueryParser_feature_flag>>, default_prefix: impl Into<Option<T>>, ) -> Query
where T: AsRef<str> + Default,

Parse the given query text into a Query instance

Source

pub fn stoplist(&self) -> TermIter

Return an iterator over terms omitted from the query as stopwords

Source

pub fn unstem(&self, term: impl AsRef<str>) -> TermIter

Return an iterator over unstemmed forms of the given stemmed query term

Trait Implementations§

Source§

impl Default for QueryParser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.