search_query.parser_base
Base query parser.
Classes
|
|
|
Abstract base class for query string parsers |
- class search_query.parser_base.QueryListParser(query_list: str, *, parser_class: type[QueryStringParser], field_general: str)
Bases:
object
- LIST_ITEM_REFERENCE = re.compile('#\\d+')
- LIST_QUERY_LINE_REGEX: Pattern = re.compile('^(\\d+).\\s+(.*)$')
- assign_linter_messages(parser_messages, linter) None
Assign linter messages to the appropriate query nodes.
- build_query_str() Tuple[str, dict]
Build the query string from the list format.
- tokenize_list() None
Tokenize the query_list.
- tokenize_operator_node(query_str: str, node_nr: int) list
Tokenize the query string into list-references and logic operator tokens.
- class search_query.parser_base.QueryStringParser(query_str: str, *, field_general: str = '', offset: dict | None = None, original_str: str | None = None, silent: bool = False)
Bases:
ABC
Abstract base class for query string parsers
- LOGIC_OPERATOR_REGEX = re.compile('\\b(AND|OR|NOT)\\b', re.IGNORECASE)
- OPERATOR_REGEX: re.Pattern = re.compile('^(AND|OR|NOT)$', re.IGNORECASE)
- adjust_token_positions() None
Adjust virtual positions of tokens using offset mapping.
- combine_subsequent_terms() None
Combine all consecutive TERM tokens into one.
- linter: QueryStringLinter
- print_tokens() None
Print the tokens in a formatted table.
- split_operators_with_missing_whitespace() None
Split operators that are not separated by whitespace.