project Utilities / File Location Listing avatar

utilities/file_location_listing#20: Limit number of results returned



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.1
Created: 30-Dec-23 15:45



Description

It should be possible for the search portal to supply a maximum number of results to be returned



Toggle State Changes

Activity


assigned to @btasker

mentioned in issue #16

Need to think about how best to implement this - utilities/file_location_listing#16 introduced multi-threading so it's not as simple as just maintaining a counter.

Options:

  • run a counter per thread and then apply the limit again once the results have been concatenated
  • Divide the limit by CONCURRENCY and pass that into the threads

Neither is perfect. If we split the counter between threads we might end up (artificially) getting lower than the desired number (if thread1 could have returned 1500 items and thread2 10, giving them a limit of 500 each isn't going to work very well).

If we have each thread collect up to the limit and then truncate down, we're going to be doing more work than necessary: with a limit of 1000 and 4 threads, we might collect 4000 items and then only actually return 1000 to the browser.

I think, for simplicities sake, though, we'll have each thread observe the provided counter. It's not particularly efficient, but it's still more efficient than chucking 4K items into the browser unnecessarily

verified

mentioned in commit 0b94f28f9cc2769727e74745f1091296a31c74db

Commit: 0b94f28f9cc2769727e74745f1091296a31c74db 
Author: B Tasker                            
                            
Date: 2023-12-30T16:10:45.000+00:00 

Message

feat: implement and honour limit attribute in javascript payload (utilities/file_location_listing#20)

+43 -12 (55 lines changed)

This is implemented.

The search portal will, by default, cap to 300 results - the search result count indicates whether this has been hit

Screenshot_20231230_161125

Clicking Capped will remove the cap and resubmit the search (any further searches will also be uncapped, until the browser tab is next refreshed)

mentioned in issue #35

mentioned in issue #49