Page MenuHomeSoftware Heritage

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

Authored by vlorentz on Tue, Oct 29, 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

vlorentz created this revision.Tue, Oct 29, 5:10 PM
anlambert requested changes to this revision.Tue, Oct 29, 5:31 PM
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.Tue, Oct 29, 5:31 PM
vlorentz updated this revision to Diff 7528.Wed, Oct 30, 5:15 PM
  • doc
  • max 1000
  • browse
vlorentz marked 2 inline comments as done.Wed, Oct 30, 5:17 PM
anlambert requested changes to this revision.Thu, Oct 31, 3:51 PM
anlambert added inline comments.
swh/web/tests/api/views/test_origin.py
477

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

This revision now requires changes to proceed.Thu, Oct 31, 3:51 PM
vlorentz updated this revision to Diff 7618.Mon, Nov 4, 12:15 PM

update test

anlambert accepted this revision.Mon, Nov 4, 1:18 PM
This revision is now accepted and ready to land.Mon, Nov 4, 1:18 PM
This revision was landed with ongoing or failed builds.Mon, Nov 4, 1:20 PM
This revision was automatically updated to reflect the committed changes.