search-query
Search Query: A Python package designed to load, lint, translate, save, improve, and automate academic literature search queries.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: joss.theoj.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.2%) to scientific vocabulary
Keywords
Repository
Search Query: A Python package designed to load, lint, translate, save, improve, and automate academic literature search queries.
Basic Info
- Host: GitHub
- Owner: CoLRev-Environment
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://colrev-environment.github.io/search-query/
- Size: 2.71 MB
Statistics
- Stars: 3
- Watchers: 2
- Forks: 6
- Open Issues: 7
- Releases: 4
Topics
Metadata Files
README.md
Search Query is a Python package designed to load, lint, translate, save, improve, and automate academic literature search queries. It is extensible and currently supports PubMed, EBSCOHost, and Web of Science. The package can be used programmatically, through the command line, or as a pre-commit hook. It has zero dependencies and integrates in a variety of environments. The parsers and linters are battle-tested on peer-reviewed searchRxiv queries.
Installation
To install search-query, run:
commandline
pip install search-query
Quickstart
Creating a query programmatically is simple: ```python from search_query import OrQuery, AndQuery
Typical building-blocks approach
digitalsynonyms = OrQuery(["digital", "virtual", "online"], field="abstract")
worksynonyms = OrQuery(["work", "labor", "service"], field="abstract")
query = AndQuery([digitalsynonyms, worksynonyms])
We can also parse a query from a string or a JSON search file (see the [overview of platform identifiers](https://colrev-environment.github.io/search-query/platforms/platform_index.html))
python
from search_query.parser import parse
querystring = '("digital health"[Title/Abstract]) AND ("privacy"[Title/Abstract])'
query = parse(querystring, platform="pubmed")
A useful feature of parsers is the built-in **linter** functionality, which helps us to validate the query by identifying syntactical errors:
python
from search_query.parser import parse
querystring = '("digital health"[Title/Abstract]) AND ("privacy"[Title/Abstract]' query = parse(querystring, platform="pubmed")
Output:
❌ Fatal: unbalanced-parentheses (PARSE_0002)
- Unbalanced opening parenthesis
Query: ("digital health"[Title/Abstract]) AND ("privacy"[Title/Abstract]
^^^
Once we have created a `query` object, we can translate it for different databases.
Note how the syntax is translated and how the search for `Title/Abstract` is split into two elements:
python
from search_query.parser import parse
querystring = '("digital health"[Title/Abstract]) AND ("privacy"[Title/Abstract])' pubmedquery = parse(querystring, platform="pubmed") wosquery = pubmedquery.translate(targetsyntax="wos") print(wosquery.tostring())
Output:
(AB="digital health" OR TI="digital health") AND (AB="privacy" OR TI="privacy")
``` For a more detailed overview of the package’s functionality, see the documentation.
Demo
A Jupyter Notebook demo (hosted on Binder) is available here:
Encounter a problem?
If you find a bug or run into any issues while using the package, please open an issue or contact one of the developers.
How to cite
Eckhardt, P., Ernst, K., Fleischmann, T., Geßler, A., Schnickmann, K., Thurner, L., and Wagner, G. "search-query: An Open-Source Python Library for Academic Search Queries".
The package was developed as part of Bachelor's theses:
- Fleischmann, T. (2025). Advances in literature search queries: Validation and translation of search strings for EBSCOHost. Otto-Friedrich-University of Bamberg.
- Geßler, A. (2025). Design of an Emulator for API-based Academic Literature Searches. Otto-Friedrich-University of Bamberg.
- Schnickmann, K. (2025). Validating and Parsing Academic Search Queries: A Design Science Approach. Otto-Friedrich-University of Bamberg.
- Eckhardt, P. (2025). Advances in literature searches: Evaluation, analysis, and improvement of Web of Science queries. Otto-Friedrich-University of Bamberg.
- Ernst, K. (2024). Towards more efficient literature search: Design of an open source query translator. Otto-Friedrich-University of Bamberg.
Not what you are looking for?
This Python package was developed with the purpose of integrating it into other literature management tools. If that isn't your use case, it might be useful for you to look at these related tools:
License
This project is distributed under the MIT License.
Owner
- Name: CoLRev-Environment
- Login: CoLRev-Environment
- Kind: organization
- Repositories: 1
- Profile: https://github.com/CoLRev-Environment
JOSS Publication
search-query: An open source Python library for academic search queries
Authors
Tags
Search query Literature search Literature review Meta-analysisGitHub Events
Total
- Create event: 27
- Release event: 2
- Issues event: 18
- Watch event: 1
- Delete event: 27
- Member event: 1
- Issue comment event: 22
- Push event: 247
- Pull request review comment event: 1
- Pull request event: 57
- Fork event: 5
Last Year
- Create event: 27
- Release event: 2
- Issues event: 18
- Watch event: 1
- Delete event: 27
- Member event: 1
- Issue comment event: 22
- Push event: 247
- Pull request review comment event: 1
- Pull request event: 57
- Fork event: 5
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 13
- Total pull requests: 36
- Average time to close issues: 9 days
- Average time to close pull requests: 13 days
- Total issue authors: 3
- Total pull request authors: 5
- Average comments per issue: 0.62
- Average comments per pull request: 0.31
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 15
Past Year
- Issues: 13
- Pull requests: 28
- Average time to close issues: 9 days
- Average time to close pull requests: 9 days
- Issue authors: 3
- Pull request authors: 5
- Average comments per issue: 0.62
- Average comments per pull request: 0.39
- Merged pull requests: 8
- Bot issues: 0
- Bot pull requests: 7
Top Authors
Issue Authors
- geritwagner (6)
- amcandio (6)
- Peteer98 (1)
Pull Request Authors
- github-actions[bot] (17)
- geritwagner (13)
- k-schnickmann (5)
- ThomasFleischmann (2)
- Peteer98 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 5,747 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
pypi.org: search-query
Package for managing literature search queries.
- Documentation: https://search-query.readthedocs.io/
- License: MIT
-
Latest release: 0.12.0
published 8 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/checkout v3 composite
- repo-sync/pull-request v2 composite
- pylint ^3.0.0 develop
- pytest ^7.4.2 develop
- python ^3.8
- actions/checkout v3 composite
- actions/setup-python v4 composite
- astroid 3.0.3
- colorama 0.4.6
- dill 0.3.8
- exceptiongroup 1.2.1
- iniconfig 2.0.0
- isort 5.13.2
- mccabe 0.7.0
- packaging 24.0
- platformdirs 4.2.1
- pluggy 1.5.0
- pylint 3.0.1
- pytest 7.4.4
- tomli 2.0.1
- tomlkit 0.12.4
- typing-extensions 4.11.0
