Skip to main content

parse_query

Function parse_query 

Source
pub fn parse_query(query: &str) -> Result<ParsedQuery, InvalidQuery>
Expand description

Parse an FTS query string into positive and negative term lists.

Recognises:

  • NOT <term> — the word NOT (case-sensitive) followed by a whitespace- separated term marks that term as negative.
  • -<term> — a term prefixed with - (no space) marks it as negative.
  • Everything else is a positive term.

Returns Err(InvalidQuery::ParenthesesNotSupported) if a ( is found after NOT. Returns Err(InvalidQuery::NegativeOnly) if there are no positive terms after parsing.