search_query.parser_base
Base query parser.
Classes
QueryParserBase class |
|
|
Abstract base class for query string parsers |
- class search_query.parser_base.QueryListParser
Bases:
QueryParserBase- LIST_ITEM_REFERENCE = re.compile('#\\d+|(?:^|\\s|\\(|\\)|\\{|})([sScC]\\d+|\\d{1,2})(?=$|\\s|\\(|\\)|\\{|})')
- LIST_QUERY_LINE_REGEX: re.Pattern = re.compile('^\\s*(\\d+).\\s+(.*)$')
- adapt_linter_messages_for_list_query(parser_messages: List[Dict[str, Any]], artificial_to_original_pos: Dict[int, Tuple[int, int]]) None
Map parser messages to their original list-query positions.
- assign_linter_messages(parser_messages: List[Dict[str, Any]]) None
Assign linter messages to the appropriate query nodes.
- build_query_str() Tuple[str, Dict[int, int], Set[str], Dict[int, Tuple[int, int]]]
Build the query string from the list format.
- extract_reference_value(reference: str) str
Extract the numerical value of a list reference.
- linter: QueryListLinter
- map_artificial_to_original_positions(parser_messages: List[Dict[str, Any]], artificial_to_original_pos: Dict[int, Tuple[int, int]]) List[Dict[str, Any]]
Map artificial parentheses to their original list-reference positions.
- query_dict: dict
- tokenize_list() None
Tokenize the query_list.
- tokenize_operator_node(query_str: str, node_nr: int) list
Tokenize list references and non-reference query text.
- class search_query.parser_base.QueryParserBase
Bases:
ABCQueryParserBase class
- linter: QueryStringLinter | QueryListLinter
- class search_query.parser_base.QueryStringParser(query_str: str, *, field_general: str = '', offset: dict | None = None, original_str: str | None = None, silent: bool = False, ignore_failing_linter: bool = False)
Bases:
QueryParserBase,ABCAbstract 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 consecutive TERM tokens and quoted text into single tokens.
- 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.
- tokens: list