search_query
Top-level package for SearchQuery.
- class search_query.AndQuery(children: List[str | Query], *, field: SearchField | str | None = None, position: Tuple[int, int] | None = None, platform: str = 'generic')
- Bases: - Query- AND Query - selects_record(record_dict: dict) bool
- Abstract method to be implemented by subclasses to select records. 
 
- class search_query.NEARQuery(value: str, children: List[str | Query], *, field: SearchField | str | None = None, position: Tuple[int, int] | None = None, distance: int, platform: str = 'generic')
- Bases: - Query- NEAR Query - property distance: int | None
- Distance property. 
 - selects_record(record_dict: dict) bool
- Check if the record matches the NEAR query. 
 
- class search_query.OrQuery(children: List[str | Query], *, field: SearchField | str | None = None, position: Tuple[int, int] | None = None, platform: str = 'generic')
- Bases: - Query- OR Query Class - selects_record(record_dict: dict) bool
- Abstract method to be implemented by subclasses to select records. 
 
- class search_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. 
 
- class search_query.SearchFile(search_string: str, platform: str, authors: list[dict] | None = None, record_info: dict | None = None, date: dict | None = None, search_results_path: str | Path | None = None, **kwargs: dict)
- Bases: - object- SearchFile class. - get_search_history_path(search_history_path: str | Path | None = None) Path
- Get the search history path. 
 - save(search_history_path: str | Path | None = None) None
- Save the search file to a JSON file. 
 - set_search_history_file_path(path: str | Path | None) None
- Set or clear the explicit search-history file path (stored privately). Passing None clears the override so the derived path is used again. 
 - set_search_results_path(path: str | Path | None) None
- Set or clear the explicit search-results file path. Passing None clears the path. 
 - to_dict() dict
- Convert the search file to a dictionary. 
 
- search_query.load_search_file(search_history_path: str | Path) SearchFile
- Load a search file from a JSON file. 
Modules
| CLI for search-query. | |
| Constants for search-query | |
| Database and filters. | |
| Database and filters. | |
| Top-level package for EBSCOHost. | |
| Exceptions of SearchQuery. | |
| Top-level package for generic queries. | |
| Query linter hook. | |
| Validator for search queries. | |
| Version-aware parser dispatch. | |
| Base query parser. | |
| Top-level package for PubMed. | |
| Query class. | |
| AND Query | |
| NEAR Query | |
| NOT Query | |
| OR Query | |
| Range Query | |
| Query class. | |
| Registry for search query components. | |
| SearchFile parser. | |
| Pubmed serializer. | |
| Structured serializer. | |
| Pubmed query translator. | |
| Utilities for upgrading search queries between versions. | |
| Utilities for SearchQuery. | |
| Top-level package for WoS. |