How to search by Species or Genus without full match
Solved!Posted in General by Lukas Kalcok Wed May 29 2019 20:47:43 GMT+0000 (Coordinated Universal Time)·9·Viewed 821 times
I would like to have a search functionality that supports the %like% sql.
something like this:
https://fishbase.ropensci.org/species?Species=ramir
inestead of filling in the whole word:
https://fishbase.ropensci.org/species?Species=ramirezi
How to achive this currently?
Thank you for your answer.
Thanks for your question Lukas. We've had this on our radar for many years now https://github.com/ropensci/fishbaseapi/issues/59 It's just a matter of finding the time to do it. Looking into it again now ... hopefully will have something to try soon
the /taxa route was a more natural place to put fuzzy search - it's been updated so you can fuzzy search on genus and species - see https://fishbaseapi.readme.io/docs/taxa
marked this as solved
I'm sorry to point this out, but this does not seem to be solved from my point.
When I hit this
https://fishbase.ropensci.org/taxa?species=Abactochromis
it returns the same as
https://fishbase.ropensci.org/taxa
It definitely does not filter fish by the species name. Same applies for genus:
https://fishbase.ropensci.org/taxa?genus=Aaptosyax
vs
https://fishbase.ropensci.org/taxa
Or Am I missing something?
Ok sorry it is solved but the documentation here make it in this way:
https://fishbaseapi.readme.io/docs/taxa
it generates the requests in a small letters in from 'species' but it should be 'Species'
Same for 'Genus'
Thank you!
you're right, it should be upper case Genus and Species
Sorry to be a bad person and bringer of bad news.
I've also find a small bug in that endpoint:
This https://fishbase.ropensci.org/taxa will return total:
"count": 34126,
But this : https://fishbase.ropensci.org/taxa?offset=10 will return total:
"count": 34116,
This means that the total is actually not total amount of items. It shows an amount of item minus current offset.
I do not know if this is expected or not.
Lukas
I'm currently building a webapplication in Angular 8 to utilise this DB so that is why I'm finding all these issues.
You can have a look at a repo :
https://github.com/izy-izzy/fishlore
Lukas
That genus/species is fixed in the docs.
Thanks for the report on the count number. Will fix that