pub struct QueryLanguageParser { /* private fields */ }Expand description
Query language parser with schema awareness
Implementations§
Source§impl QueryLanguageParser
impl QueryLanguageParser
pub fn new( schema: Arc<Schema>, default_fields: Vec<Field>, tokenizers: Arc<TokenizerRegistry>, ) -> Self
Sourcepub fn with_router(
schema: Arc<Schema>,
default_fields: Vec<Field>,
tokenizers: Arc<TokenizerRegistry>,
router: QueryFieldRouter,
) -> Self
pub fn with_router( schema: Arc<Schema>, default_fields: Vec<Field>, tokenizers: Arc<TokenizerRegistry>, router: QueryFieldRouter, ) -> Self
Create a parser with a query field router
Sourcepub fn set_router(&mut self, router: QueryFieldRouter)
pub fn set_router(&mut self, router: QueryFieldRouter)
Set the query field router
Sourcepub fn router(&self) -> Option<&QueryFieldRouter>
pub fn router(&self) -> Option<&QueryFieldRouter>
Get the query field router
Sourcepub fn parse(&self, query_str: &str) -> Result<Box<dyn Query>, String>
pub fn parse(&self, query_str: &str) -> Result<Box<dyn Query>, String>
Parse a query string into a Query
Supports query language syntax (field:term, AND, OR, NOT, grouping) and plain text (tokenized and searched across default fields).
If a query field router is configured, the query is first checked against routing rules. If a rule matches:
- In exclusive mode: only the target field is queried with the substituted value
- In additional mode: both the target field and default fields are queried
Auto Trait Implementations§
impl Freeze for QueryLanguageParser
impl !RefUnwindSafe for QueryLanguageParser
impl Send for QueryLanguageParser
impl Sync for QueryLanguageParser
impl Unpin for QueryLanguageParser
impl !UnwindSafe for QueryLanguageParser
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