Bug 38868 - numSearchResults and OPACnumSearchResults are not sanity checked
Summary: numSearchResults and OPACnumSearchResults are not sanity checked
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-13 03:33 UTC by David Cook
Modified: 2025-01-15 06:14 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2025-01-13 03:33:22 UTC
It turns out that numSearchResults and OPACnumSearchResults are not sanity checked.

If you have high numbers in these system preferences, your search results are going to get very slow, and your browser may actually struggle to render the large quantity of HTML. 

At a glance, we actually look up these sysprefs in more places than you'd think... and since we use the "preference" function, we don't have an existing way of doing sanity checks (either at setting time or getting time). 

--

I'd say the options look like building sanity checks into the "preference" function, starting a Koha::Search object that can be used for getting search information, or adding something into our current search classes (although that might be too heavy weight for some contexts).

--

Due to the volume of system preferences, obviously adding sanity checks to all system preferences could get unwieldy. But I reckon something needs to be done.
Comment 1 David Cook 2025-01-15 05:33:35 UTC
I've checked Hea for numSearchResults and OPACnumSearchResults, but they don't appear in the results, which is unfortunate.
Comment 2 David Cook 2025-01-15 06:14:46 UTC
By the way, when numSearchResultsDropdown is enabled, the max results able to be chosen by the dropdown menu is 100. 

Perhaps that would be a sane max limit to enforce for these system preferences.