Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle custom limit in query parameter #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MattiasSp
Copy link
Contributor

Fixes #110.

Related to origo-map/origo#1413 and origo-map/origo#1418.

The limit on the number of search hits returned now follows the same behaviour in the following handlers:

The maximum number of hits returned by Origo Server is controlled solely in dbconfig.js. A more specific limit will take precedence over a more general limit:
module.exports.models.search.search.tables[0].limit > module.exports.models.search.search.limit > module.exports.limit

If the request url includes the new &limit={max no of hits} parameter, this parameter's value will be used only if it is lower than that set in dbconfig.js.

If there is no limit set at all, either in dbconfig.js or as a url parameter, then 100 hits is the maximum (same as before).

A special note: I added limit handling for the oracledefault.js db model to make it behave similarly to pgdefault.js and mssqldefault.js. I also removed the limit parameters that was being sent to the db models.

  • It was only used in pg and mssql (so not consistent)
  • There was duplication of logic
  • There were default values (1000) that could never be assigned (since the value had 100 set both in dbconfig.js and in the handlers

@MattiasSp
Copy link
Contributor Author

FYI regarding the failed test: the warnings are about problems in the file routes/mapstate.js, which this PR doesn't touch. So I think it should be disregarded and those problems should be fixed in a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the user to limit results using a query parameter
1 participant