search_query.query
The query classes implement a generic query as an intermediate representation (IR) that abstracts away platform-specific syntax. Parsers from any platform produce the same tree of logical operators and terms, enabling cross-platform translation and version upgrades.
Example round-trip:
from search_query.parser import parse
query_wos = parse('TS=("digital health")', platform='wos')
query_generic = query_wos.translate(target_syntax='generic')
query_back = query_generic.translate(target_syntax='wos')
Query class.
Classes
| 
 | Query class. | 
| 
 | SearchField class. | 
- class search_query.query.Query(value: str, *, operator: bool = True, field: SearchField | None = None, children: List[str | Query] | None = None, position: Tuple[int, int] | None = None, platform: str = 'generic')
- Bases: - object- Query class. - classmethod create(value: str, *, operator: bool = True, field: SearchField | None = None, children: List[str | Query] | None = None, position: Tuple[int, int] | None = None, platform: str = 'generic', distance: int = 0) Query
- Factory method for query creation. 
 - evaluate(records_dict: dict) dict
- Evaluate the query against records using colrev_status labels. - rev_included: relevant 
- rev_excluded / rev_prescreen_excluded: irrelevant 
- others: ignored 
 
 - property field: SearchField | None
- Search field property. 
 - get_nr_leaves() int
- Returns the number of leaves in the query tree 
 - is_term() bool
- Check whether the SearchQuery is a term. 
 - property operator: bool
- Operator property. 
 - property platform: str
- Platform property. 
 - selects(*, record_dict: dict) bool
- Indicates whether the query selects a given record. 
 - selects_record(record_dict: dict) bool
- Abstract method to be implemented by subclasses to select records. 
 - set_platform_unchecked(platform: str, silent: bool = False) None
- Set the platform for this query node without validation. This is an optional utility for parsers. 
 - to_generic_string() str
- Prints the query in generic syntax 
 - to_string() str
- Prints the query as a string 
 - to_string_structured_2() str
- Prints the query in a structured expression format. 
 - to_structured_string() str
- Prints the query in generic syntax 
 - translate(target_syntax: str) Query
- Translate the query to the target syntax using the provided translator. 
 - property value: str
- Value property.