Skip to content
Snippets Groups Projects
Commit bef588f0 authored by Demian Katz's avatar Demian Katz
Browse files

Added limit setting to combined.ini.

- Resolves VUFIND-973.
parent ef85a2fa
No related merge requests found
......@@ -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
......@@ -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;
}
}
......@@ -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;">
......
......@@ -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">
......
......@@ -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'])): ?>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment