diff --git a/config/vufind/Primo.ini b/config/vufind/Primo.ini index 4d77dcb5c07cd575113557b62a29e474db893528..48a9fefe0908ef4f64bce100305eeec962acda09 100644 --- a/config/vufind/Primo.ini +++ b/config/vufind/Primo.ini @@ -18,6 +18,15 @@ timeout = 30 ; Your API id apiId = my-id +; This section controls the result limit options for search results. default_limit +; sets the default number of results per page. limit_options is a comma-separated +; list of numbers to be presented to the end-user. If only one limit is required, +; set default_limit and leave limit_options commented out. +; WARNING: using large limits may require you to raise your PHP memory limits to +; avoid errors. +default_limit = 20 +;limit_options = 10,20,40,60,80,100 + ; These are the default recommendations modules to use when no specific setting ; are found in the [TopRecommendations] or [SideRecommendations] sections below. ; See the comments above those sections for details on legal settings. You may diff --git a/module/VuFind/src/VuFind/Search/Primo/Options.php b/module/VuFind/src/VuFind/Search/Primo/Options.php index 5ad623e41303251de1f2fb7e9431f01e408a32b9..31fb5c6a82f1306aeaabe0942c33d1adf9511211 100644 --- a/module/VuFind/src/VuFind/Search/Primo/Options.php +++ b/module/VuFind/src/VuFind/Search/Primo/Options.php @@ -79,6 +79,15 @@ class Options extends \VuFind\Search\Base\Options // Load the search configuration file: $searchSettings = $configLoader->get($this->searchIni); + // Set up limit preferences + if (isset($searchSettings->General->default_limit)) { + $this->defaultLimit = $searchSettings->General->default_limit; + } + if (isset($searchSettings->General->limit_options)) { + $this->limitOptions + = explode(",", $searchSettings->General->limit_options); + } + // Load search preferences: if (isset($searchSettings->General->retain_filters_by_default)) { $this->retainFiltersByDefault