gbif / hosted-portals

Support material for establishing the GBIF Hosted Portals
Apache License 2.0
9 stars 6 forks source link

Include doi as a query parameter in the Literature search #241

Closed bienflorencia closed 1 year ago

bienflorencia commented 1 year ago

Hello! I want to add specific DOIs to the literature search. I saw that doi is a query parameter for the Literature API. However, I cannot make it work.

As an example, here's a doi = https://doi.org/10.1038/s41598-020-79074-8. When I explore the literature search in gbif.org, I can see that the call is: https://www.gbif.org/resource/search?contentType=literature&doi=10.1038~2Fs41598-020-79074-8

It seems that the / is changed to ~2F Not sure if this is related. It could also be that I'm not coding it right :)

I tried including the plain text, and then here I was trying a scape character, but also didn't work: https://github.com/gbif/hp-biodiversidata/blob/master/_includes/js/config.js#L68

Thanks!

MortenHofft commented 1 year ago

It looks like you are trying to add 10.15468\\/dl.klwehw. But that looks to me like a gbif download doi. The DOI filter as you see it on GBIF.org works on the doi's of the papers.

So it will not do anything.

Secondly I have to enable search by DOI, I haven't done so. But I will now.

Thanks

bienflorencia commented 1 year ago

Sorry Morten, the doi "10.15468\/dl.klwehw" is not the one I was using. That was just a test after many other tests to make it work. I was trying 10.1038/s41598-020-79074-8 and failed. But it's probably related to the fact that the search by doi is not enabled. I updated it now.

MortenHofft commented 1 year ago

I have changed the predicate to a nested type. https://github.com/gbif/hp-biodiversidata/commit/5061c217aac12327b2f586774bbf27de514b9588 As that worked here and now

UPDATE: i have now updated the backend to allow for simpler querying on nested objects in ElasticSearch in this commit https://github.com/gbif/gbif-web/commit/f2a64ab5db5b3f13978a0dabf5e87a0c4b4449f6

So I have changed your config back to https://github.com/gbif/hp-biodiversidata/commit/b070d8ab190fdce9822522eb83b88f7acf6b8200

bienflorencia commented 1 year ago

Dear Morten, any reason why this doesn't work: https://api.gbif.org/v1/literature/search?doi=10.3897/BDJ.7.e36226

I'm trying to use this DOI in the literature search (and a bunch of others), but it's not retrieving the paper. Is it because it's a data paper?

Here's the code: https://github.com/gbif/hp-biodiversidata/blob/511cfdff5b90f1703277ff563727049c0d005b9e/_includes/js/config.js#L84

Thanks!

timrobertson100 commented 1 year ago

This looks like a mistake - it appears to be case sensitive.

I'll let @MortenHofft determine where this should be fixed but perhaps this is enough info for you to work around this in the meantime @bienflorencia:

https://api.gbif.org/v1/literature/search?doi=10.3897/bdj.7.e36226 works https://api.gbif.org/v1/literature/search?doi=10.3897/BDJ.7.e36226 does not