PREreview / rapid-prereview

An application for rapid, structured reviews of outbreak-related preprints
https://outbreaksci.prereview.org/
MIT License
13 stars 12 forks source link

fix: Searching for already added preprints by DOI doesn't yield any results #142

Closed mcmxcdev closed 4 years ago

mcmxcdev commented 4 years ago

Closes #114.

This was very hard to debug.

Before my changes, the search worked and delivered results for words ("hello world") or arXivId ("1909.13766") just fine.

When entering a DOI, the first part of the http request to the API would look like this: http://127.0.0.1:3000/api/preprint/?q=(name:10.1101/780627+OR+doi:"10.1101/780627")

The doi: part would have worked because it was encapsulated with quotes, but the name: part was not quoted for single words and crashed the api call with a 500 error because it could not interpret the value 10.1101/780627, since there is a forward slash in the middle of the value.

A user can input any kind of characters into the search bar, so the safest way was to always quote the name: part.

Alternatively, another solution would be to only query for:

But then, that would defeat the whole purpose of having OR queries.


IssueHunt Summary ### Referenced issues This pull request has been submitted to: - [#114: Searching for already added preprints by DOI doesn't yield any results](https://issuehunt.io/repos/208844948/issues/114) ---