Page MenuHomeSoftware Heritage

Bound the value of the 'limit' parameter to origin-search.
ClosedPublic

Authored by vlorentz on Oct 29 2019, 5:10 PM.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

anlambert added a subscriber: anlambert.

I agree that the limit parameter should have an upper bound but a value of 100 feels too low for me.

Also, the browse endpoint for searching origins should be updated the same way (see https://forge.softwareheritage.org/source/swh-web/browse/master/swh/web/browse/views/origin.py$181).
This also means that we should have a variable somewhere holding that upper bound value for the limit parameter of origin search.

swh/web/api/views/origin.py
197–198

docstring should be updated with the limit upper bound here.

222

A value of 100 seems too low for a limit upper bound. I think you could set it to 1000 or maybe even 10000 depending on how fast elasticsearch returns a search query response.

This revision now requires changes to proceed.Oct 29 2019, 5:31 PM
anlambert added inline comments.
swh/web/tests/api/views/test_origin.py
476

The test needs to be updated after the increase of limit bound to 1000.

This revision now requires changes to proceed.Oct 31 2019, 3:51 PM
This revision is now accepted and ready to land.Nov 4 2019, 1:18 PM
This revision was landed with ongoing or failed builds.Nov 4 2019, 1:20 PM
This revision was automatically updated to reflect the committed changes.