bio-org-au / nsl-documentation

Documentation for the NSL project
Apache License 2.0
1 stars 0 forks source link

Pagination? #1

Open sckott opened 4 years ago

sckott commented 4 years ago

@pmcneil following up on discussion in https://github.com/ropensci/taxize/issues/813

I assume this is the repo for the docs at https://biodiversity.org.au/nsl/docs/main.html ? If not, sorry, and where should I go to ask about the API?

I'm curious if the NSL API has pagination? I couldn't find anything in the docs about pagination. That is, can I request a certain page? or number of results? or however you paginate (cursor, next/prev links, etc.). If there is pagination, what routes is it available on?

pmcneil commented 4 years ago

https://biodiversity.org.au/nsl/docs/main.html is the current but unfortunately out of date documentation (mainly the tree doco is out of date). There isn't any pagination on results only a limit. We haven't required it as the queries tend to be self limiting.

sckott commented 4 years ago

Thanks. What is the parameter to limit results?

xpusostomos commented 4 years ago

I think you'll find it's "max". For example:

https://biodiversity.org.au/nsl/services/search?product=APC&tree.id=51209179&name=Banksia&inc._scientific=&inc.scientific=on&inc._cultivar=&max=1&display=apc&search=true

sckott commented 4 years ago

thanks - but that doesn't seem to work on the nsl/services/suggest route. is there a limit results parameter that works on that route? i tried max, limit, per_page, perPage, none of which worked.

pmcneil commented 4 years ago

Suggestions are limited in the code of the suggestion handler, at the moment it looks like they are mostly limited to 15 results... e.g. https://github.com/bio-org-au/services-g3/blob/a7e6302ace555963ce31f90cab10e174963bac45/grails-app/services/au/org/biodiversity/nsl/SearchService.groovy#L381 The reasoning here is that suggestions give you back a quick set of the most relevant results as you type. Experience shows that the desired result is normally within the set of 15 give around 3 characters typed. (Obviously needs to be the epithet... if you type Eucalyptus you really need to get to the distinguishing part e.g. "Eucalyptus abb" before you only have one result from 3.5k Eucalyptus)

sckott commented 4 years ago

Okay, thanks.