search_query.parser_base

Base query parser.

Classes

QueryListParser(query_list, *, parser_class, ...)

QueryStringParser(query_str, *[, ...])

Abstract base class for query string parsers

class search_query.parser_base.QueryListParser(query_list: str, *, parser_class: type[QueryStringParser], search_field_general: str, mode: str = 'strict')

Bases: object

LIST_ITEM_REGEX: Pattern = re.compile('^(\\d+).\\s+(.*)$')
abstract parse() Query

Parse the query in list format.

tokenize_list() None

Tokenize the query_list.

class search_query.parser_base.QueryStringParser(query_str: str, *, search_field_general: str = '', mode: str = 'strict')

Bases: ABC

Abstract base class for query string parsers

OPERATOR_REGEX: re.Pattern = re.compile('^(AND|OR|NOT)$', re.IGNORECASE)
combine_subsequent_terms() None

Combine all consecutive SEARCH_TERM tokens into one.

linter: QueryStringLinter
abstract parse() Query

Parse the query.

print_tokens() None

Print the tokens in a formatted table.

split_operators_with_missing_whitespace() None

Split operators that are not separated by whitespace.