-
-
Notifications
You must be signed in to change notification settings - Fork 95
Remove default limit of 1000 from QuerystringSearch #1963
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
base: 9.x.x
Are you sure you want to change the base?
Conversation
Previously, QuerystringSearch imposed a hardcoded limit=1000 on all queries, even when the user did not specify a limit. This caused unexpected truncation of results. Now the limit parameter is only passed to querybuilder when explicitly provided in the request data.
|
@wesleybl thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment: To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
davisagli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default limit is there for a reason, to prevent accidental long-running requests that return too many results. I would rather keep the limit but fix the response so that it reports the total result count correctly.
|
@davisagli But isn't that hide the results? |
|
@wesleybl Yes, unless you specifically ask for more. That's intentional. (But setting items_total to the limit, instead of the actual total, is not intentional.) |
@davisagli But the frontend doesn't know how many records exist, so it can't pass a value. This limits access to the records the user might want. And with pagination, it will never return 1000 items. Note that a normal search doesn't have this limit: https://github.com/plone/plone.restapi/blob/main/src/plone/restapi/search/handler.py |
|
@jenkins-plone-org please run jobs |
If we change this, it will cause the pagination to return pages that are not reachable, causing an error. Here's the PR that inserted this: |
|
@davisagli So what's your suggestion for fixing this problem? Could we create a setting in Volto to increase this limit? But honestly, I don't think that would be the best solution. |
|
For one thing, we should make sure that the batch class used for pagination is not broken by having an actual_result_count that is higher than the limit. The whole point of the catalog returning actual_result_count is to provide this information. I need to take a closer look at all the parts of this. It may be that we can remove the default limit but I need to check some things. |
|
@davisagli I still don't quite understand your concern. Are you worried that "accidentally" more than 1000 items might be returned? Would that be through a call without parameters? Can you give an example of a call that "accidentally" returns multiple items? Today we have a default value for So calls without parameters won't return 1000 items, even without the limit. To return 1000, we would have to pass |
Previously, QuerystringSearch imposed a hardcoded limit=1000 on all queries, even when the user did not specify a limit. This caused unexpected truncation of results.
Now the limit parameter is only passed to querybuilder when explicitly provided in the request data.
Closes #1955
📚 Documentation preview 📚: https://plonerestapi--1963.org.readthedocs.build/