pybliometrics-dev / pybliometrics

Python-based API-Wrapper to access Scopus
https://pybliometrics.readthedocs.io/en/stable/
Other
401 stars 124 forks source link

ScopusSearch by DOI produces different results if space added #299

Closed MRC-94 closed 10 months ago

MRC-94 commented 10 months ago

pybliometrics version: 3.5.2

Using scopus.ScopusSearch(DOI()). Adding a space after "DOI(" returns the correct results, if no space is added, a None is returned.

Code to reproduce the bug:

doi = "10.1093/restud/rdac058"
print(pybliometrics.scopus.ScopusSearch(f"DOI({doi})").results) # This returns a None
print(pybliometrics.scopus.ScopusSearch(f"DOI( {doi})").results) # Notice space after parenthesis, this works
Michael-E-Rose commented 10 months ago

For me both work. And I can't think of a reason why it wouldn't. pybliometrics passes on the search query to Scopus: as long as it works there, it works via pybliometrics.

Try this on your system:

doi = "10.1093/restud/rdac058"
s = pybliometrics.scopus.ScopusSearch(f"DOI({doi})")
print(s.get_cache_file_age())

Then do this:

doi = "10.1093/restud/rdac058"
s = pybliometrics.scopus.ScopusSearch(f"DOI({doi})", refresh=True)
print(s.results)
MRC-94 commented 10 months ago

Thanks a lot! refresh = True solves the issue, which was indeed relevant only for old search queries.