diff --git a/config/vufind/combined.ini b/config/vufind/combined.ini index 7d658e6b06036f12bbcafd3211923d1515054111..1540ab1a270e17638e2a4af6e554b2aa3afe8fc7 100644 --- a/config/vufind/combined.ini +++ b/config/vufind/combined.ini @@ -10,6 +10,10 @@ ; combined search in a simplified manner. ; ajax = If true, these results will load via AJAX; otherwise, they will load ; inline (default = false) +; limit = The maximum number of search results to show in this column; note +; that this must be a legal limit value for the chosen search backend. +; (Setting legal limit values may require changing limit_options in +; the appropriate configuration file -- e.g. searches.ini, Summon.ini). ; ; All display text is subject to translation and may be added to the language ; .ini files. @@ -21,9 +25,11 @@ label = Catalog ;sublabel = "library books, videos, CDs, microform, local resources" more_link = "More catalog results" +;limit = 10 [Summon] label = Summon ;sublabel = "full-text articles, e-books, electronic subscription resources" more_link = "More Summon results" -ajax = true \ No newline at end of file +ajax = true +;limit = 10 \ No newline at end of file diff --git a/module/VuFind/src/VuFind/Controller/CombinedController.php b/module/VuFind/src/VuFind/Controller/CombinedController.php index 2296be692c5eb28745d5c34f4f4e21cbafa3a942..77e2615c0aa7e478e97c3c16bf6c54d092f9579b 100644 --- a/module/VuFind/src/VuFind/Controller/CombinedController.php +++ b/module/VuFind/src/VuFind/Controller/CombinedController.php @@ -85,6 +85,8 @@ class CombinedController extends AbstractSearch list($controller, $action) = explode('-', $currentOptions->getSearchAction()); $settings = $config[$searchClassId]; + + $this->adjustQueryForSettings($settings); $settings['view'] = $this->forwardTo($controller, $action); // Send response: @@ -130,6 +132,7 @@ class CombinedController extends AbstractSearch $config = $this->getServiceLocator()->get('VuFind\Config')->get('combined') ->toArray(); foreach ($config as $current => $settings) { + $this->adjustQueryForSettings($settings); $currentOptions = $options->get($current); list($controller, $action) = explode('-', $currentOptions->getSearchAction()); @@ -189,4 +192,18 @@ class CombinedController extends AbstractSearch throw new \Exception('Unexpected search type.'); } } + + /** + * Adjust the query context to reflect the current settings. + * + * @param array $settings Settings + * + * @return void + */ + protected function adjustQueryForSettings($settings) + { + // Apply limit setting, if any: + $query = $this->getRequest()->getQuery(); + $query->limit = isset($settings['limit']) ? $settings['limit'] : null; + } } diff --git a/themes/blueprint/templates/combined/results-list.phtml b/themes/blueprint/templates/combined/results-list.phtml index 3f022a3592aa1ada891b74c193cce7cfc4e99de0..9d4f6ebc88b32f5303bad422fced34c25668a7bb 100644 --- a/themes/blueprint/templates/combined/results-list.phtml +++ b/themes/blueprint/templates/combined/results-list.phtml @@ -4,7 +4,12 @@ $params = $results->getParams(); $lookfor = $params->getDisplayQuery(); $recordTotal = $results->getResultTotal(); + + // More link should use default limit, not custom limit: + $limit = $params->getLimit(); + $params->setLimit($params->getOptions()->getDefaultLimit()); $moreUrl = $this->url($params->getOptions()->getSearchAction()) . $results->getUrlQuery()->setPage(1); + $params->setLimit($limit); ?> <? if ($currentSearch['more_link']): ?> <div style="float: right;"> diff --git a/themes/bootstrap/templates/combined/results-list.phtml b/themes/bootstrap/templates/combined/results-list.phtml index 444192f53488e8d966f2fedd24d60de7b0c1474e..5fc0208e9cb52c666de4c5fc826f425134e29a35 100644 --- a/themes/bootstrap/templates/combined/results-list.phtml +++ b/themes/bootstrap/templates/combined/results-list.phtml @@ -4,7 +4,12 @@ $params = $results->getParams(); $lookfor = $params->getDisplayQuery(); $recordTotal = $results->getResultTotal(); + + // More link should use default limit, not custom limit: + $limit = $params->getLimit(); + $params->setLimit($params->getOptions()->getDefaultLimit()); $moreUrl = $this->url($params->getOptions()->getSearchAction()) . $results->getUrlQuery()->setPage(1); + $params->setLimit($limit); ?> <? if ($currentSearch['more_link']): ?> <div class="pull-right"> diff --git a/themes/jquerymobile/templates/combined/results-list.phtml b/themes/jquerymobile/templates/combined/results-list.phtml index 9bf0da0896d7483562008f1ab73d84470bf09883..3fc976f742154f69e4d0faf2fca65c6d38666385 100644 --- a/themes/jquerymobile/templates/combined/results-list.phtml +++ b/themes/jquerymobile/templates/combined/results-list.phtml @@ -4,7 +4,12 @@ $params = $results->getParams(); $lookfor = $params->getDisplayQuery(); $recordTotal = $results->getResultTotal(); + + // More link should use default limit, not custom limit: + $limit = $params->getLimit(); + $params->setLimit($params->getOptions()->getDefaultLimit()); $moreUrl = $this->url($params->getOptions()->getSearchAction()) . $results->getUrlQuery()->setPage(1); + $params->setLimit($limit); ?> <h2><?=$this->transEsc($currentSearch['label'])?></h2> <? if (isset($currentSearch['sublabel'])): ?>