yasuki_core.search.boolean_query.parse_query#

parse_query(query)[source]#

Parse a search query into a boolean AST.

Grammar (precedence NOT > AND > OR, parentheses overriding): terms juxtaposed with whitespace are ANDed, OR combines alternatives, - negates the leaf or (group) it prefixes. Unbalanced parentheses are tolerated (auto-closed) and stray - tokens are dropped, so a mid-typed live-search query still parses.

Parameters:
querystr

Raw search query.

Returns:
rootNode or None

The AST root, or None for a query with no constraints (empty, or only stray dashes).