From 39de523f5f4cdc24a900f9942fd01e469f14adf8 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 31 Aug 2012 14:48:28 -0400 Subject: [PATCH] Eliminated __call method in \VuFind\Search\Base\Results; explicit getParams() calls make code more comprehensible. --- .../VuFind/src/VuFind/Autocomplete/Solr.php | 6 +-- .../src/VuFind/Controller/AbstractSearch.php | 6 +-- .../src/VuFind/Controller/AjaxController.php | 4 +- .../VuFind/Controller/SearchController.php | 21 +++++---- .../VuFind/Controller/SummonController.php | 6 ++- .../src/VuFind/Recommend/AuthorFacets.php | 2 +- .../src/VuFind/Recommend/AuthorInfo.php | 2 +- .../VuFind/Recommend/AuthorityRecommend.php | 2 +- .../src/VuFind/Recommend/PubDateVisAjax.php | 4 +- .../src/VuFind/Recommend/SideFacets.php | 2 +- .../src/VuFind/Recommend/SummonDatabases.php | 2 +- .../src/VuFind/Recommend/SwitchType.php | 2 +- .../VuFind/Recommend/WorldCatIdentities.php | 2 +- .../src/VuFind/Recommend/WorldCatTerms.php | 2 +- .../VuFind/src/VuFind/Search/Base/Results.php | 46 +++++++++---------- .../src/VuFind/Search/Favorites/Results.php | 10 ++-- module/VuFind/src/VuFind/Search/Minified.php | 8 ++-- .../VuFind/src/VuFind/Search/Solr/Params.php | 2 +- .../VuFind/src/VuFind/Search/Solr/Results.php | 30 ++++++------ .../Search/SolrAuthorFacets/Results.php | 9 ++-- .../src/VuFind/Search/Summon/Results.php | 2 +- .../VuFind/src/VuFind/Search/Tags/Results.php | 9 ++-- module/VuFind/src/VuFind/Search/UrlHelper.php | 34 +++++++------- .../src/VuFind/Search/WorldCat/Results.php | 8 ++-- .../VuFind/src/VuFind/Statistics/Search.php | 7 ++- .../VuFind/Theme/Root/Helper/ResultFeed.php | 6 ++- .../Theme/Root/Helper/SortFacetList.php | 2 +- .../Recommend/AuthorityRecommend.phtml | 2 +- .../templates/Recommend/FavoriteFacets.phtml | 2 +- .../templates/Recommend/SideFacets.phtml | 4 +- .../blueprint/templates/author/results.phtml | 2 +- .../blueprint/templates/author/search.phtml | 2 +- .../templates/search/advanced/layout.phtml | 4 +- .../templates/search/controls/limit.phtml | 2 +- .../templates/search/controls/sort.phtml | 4 +- .../templates/search/controls/view.phtml | 2 +- .../templates/search/history-table.phtml | 4 +- .../templates/search/reservessearch.phtml | 2 +- .../blueprint/templates/search/results.phtml | 18 ++++---- .../templates/Recommend/SideFacets.phtml | 2 +- .../templates/search/history-table.phtml | 4 +- .../templates/search/reservessearch.phtml | 2 +- .../templates/search/results.phtml | 6 +-- 43 files changed, 156 insertions(+), 142 deletions(-) diff --git a/module/VuFind/src/VuFind/Autocomplete/Solr.php b/module/VuFind/src/VuFind/Autocomplete/Solr.php index f7a7285e0c6..8464fc4ed4c 100644 --- a/module/VuFind/src/VuFind/Autocomplete/Solr.php +++ b/module/VuFind/src/VuFind/Autocomplete/Solr.php @@ -126,12 +126,12 @@ class Solr implements AutocompleteInterface public function getSuggestions($query) { try { - $this->searchObject->setBasicSearch( + $this->searchObject->getParams()->setBasicSearch( $this->mungeQuery($query), $this->handler ); - $this->searchObject->setSort($this->sortField); + $this->searchObject->getParams()->setSort($this->sortField); foreach ($this->filters as $current) { - $this->searchObject->addFilter($current); + $this->searchObject->getParams()->addFilter($current); } // Perform the search: diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php index 2f90c581658..04e85712991 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php @@ -225,7 +225,7 @@ class AbstractSearch extends AbstractBase } // Special case: If we're in RSS view, we need to render differently: - if ($view->results->getView() == 'rss') { + if ($view->results->getParams()->getView() == 'rss') { $response = $this->getResponse(); $response->getHeaders()->addHeaderLine('Content-type', 'text/xml'); $feed = $this->getViewRenderer()->plugin('resultfeed'); @@ -317,14 +317,14 @@ class AbstractSearch extends AbstractBase $savedSearch = $minSO->deminify(); // Fail if this is not the right type of search: - if ($savedSearch->getSearchType() != 'advanced') { + if ($savedSearch->getParams()->getSearchType() != 'advanced') { $this->flashMessenger()->setNamespace('error') ->addMessage('advSearchError_notAdvanced'); return false; } // Activate facets so we get appropriate descriptions in the filter list: - $savedSearch->activateAllFacets('Advanced'); + $savedSearch->getParams()->activateAllFacets('Advanced'); // Make the object available to the view: return $savedSearch; diff --git a/module/VuFind/src/VuFind/Controller/AjaxController.php b/module/VuFind/src/VuFind/Controller/AjaxController.php index fe9a13d3316..2e0008ea1a0 100644 --- a/module/VuFind/src/VuFind/Controller/AjaxController.php +++ b/module/VuFind/src/VuFind/Controller/AjaxController.php @@ -734,7 +734,7 @@ class AjaxController extends AbstractBase $params = new \VuFind\Search\Solr\Params(); $params->initFromRequest($this->getRequest()->getQuery()); $results = new \VuFind\Search\Solr\Results($params); - $filters = $results->getFilters(); + $filters = $params->getFilters(); $dateFacets = $this->params()->fromQuery('facetFields'); $dateFacets = empty($dateFacets) ? array() : explode(':', $dateFacets); $fields = $this->processDateFacets($filters, $dateFacets, $results); @@ -779,7 +779,7 @@ class AjaxController extends AbstractBase } $result[$current] = array($from, $to); $result[$current]['label'] - = $results->getFacetLabel($current); + = $results->getParams()->getFacetLabel($current); } return $result; } diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index 38897ea7352..68d98b11ab0 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -140,14 +140,16 @@ class SearchController extends AbstractSearch // Find the selected value by analyzing facets -- if we find match, remove // the offending facet to avoid inappropriate items appearing in the // "applied filters" sidebar! - if ($savedSearch && $savedSearch->hasFilter('illustrated:Illustrated')) { + if ($savedSearch + && $savedSearch->getParams()->hasFilter('illustrated:Illustrated') + ) { $illYes['selected'] = true; - $savedSearch->removeFilter('illustrated:Illustrated'); + $savedSearch->getParams()->removeFilter('illustrated:Illustrated'); } else if ($savedSearch - && $savedSearch->hasFilter('illustrated:"Not Illustrated"') + && $savedSearch->getParams()->hasFilter('illustrated:"Not Illustrated"') ) { $illNo['selected'] = true; - $savedSearch->removeFilter('illustrated:"Not Illustrated"'); + $savedSearch->getParams()->removeFilter('illustrated:"Not Illustrated"'); } else { $illAny['selected'] = true; } @@ -168,13 +170,14 @@ class SearchController extends AbstractSearch // Check to see if there is an existing range in the search object: if ($savedSearch) { - $filters = $savedSearch->getFilters(); + $filters = $savedSearch->getParams()->getFilters(); if (isset($filters['publishDate'])) { foreach ($filters['publishDate'] as $current) { if ($range = SolrUtils::parseRange($current)) { $from = $range['from'] == '*' ? '' : $range['from']; $to = $range['to'] == '*' ? '' : $range['to']; - $savedSearch->removeFilter('publishDate:' . $current); + $savedSearch->getParams() + ->removeFilter('publishDate:' . $current); break; } } @@ -204,13 +207,15 @@ class SearchController extends AbstractSearch // If we haven't already found a selected facet and the current // facet has been applied to the search, we should store it as // the selected facet for the current control. - if ($searchObject && $searchObject->hasFilter($fullFilter)) { + if ($searchObject + && $searchObject->getParams()->hasFilter($fullFilter) + ) { $facetList[$facet]['list'][$key]['selected'] = true; // Remove the filter from the search object -- we don't want // it to show up in the "applied filters" sidebar since it // will already be accounted for by being selected in the // filter select list! - $searchObject->removeFilter($fullFilter); + $searchObject->getParams()->removeFilter($fullFilter); } } } diff --git a/module/VuFind/src/VuFind/Controller/SummonController.php b/module/VuFind/src/VuFind/Controller/SummonController.php index e50665647ce..7799067ed87 100644 --- a/module/VuFind/src/VuFind/Controller/SummonController.php +++ b/module/VuFind/src/VuFind/Controller/SummonController.php @@ -162,13 +162,15 @@ class SummonController extends AbstractSearch // If we haven't already found a selected facet and the current // facet has been applied to the search, we should store it as // the selected facet for the current control. - if ($searchObject && $searchObject->hasFilter($fullFilter)) { + if ($searchObject + && $searchObject->getParams()->hasFilter($fullFilter) + ) { $facetList[$facet]['list'][$key]['selected'] = true; // Remove the filter from the search object -- we don't want // it to show up in the "applied filters" sidebar since it // will already be accounted for by being selected in the // filter select list! - $searchObject->removeFilter($fullFilter); + $searchObject->getParams()->removeFilter($fullFilter); } } } diff --git a/module/VuFind/src/VuFind/Recommend/AuthorFacets.php b/module/VuFind/src/VuFind/Recommend/AuthorFacets.php index 05e0f810620..3233bce2b56 100644 --- a/module/VuFind/src/VuFind/Recommend/AuthorFacets.php +++ b/module/VuFind/src/VuFind/Recommend/AuthorFacets.php @@ -105,7 +105,7 @@ class AuthorFacets implements RecommendInterface */ public function getSearchTerm() { - $search = $this->results->getSearchTerms(); + $search = $this->results->getParams()->getSearchTerms(); if (isset($search[0]['lookfor'])) { return $search[0]['lookfor']; } diff --git a/module/VuFind/src/VuFind/Recommend/AuthorInfo.php b/module/VuFind/src/VuFind/Recommend/AuthorInfo.php index 8ec61c76d9c..bc54993900c 100644 --- a/module/VuFind/src/VuFind/Recommend/AuthorInfo.php +++ b/module/VuFind/src/VuFind/Recommend/AuthorInfo.php @@ -367,7 +367,7 @@ class AuthorInfo implements RecommendInterface */ protected function getAuthor() { - $search = $this->searchObject->getSearchTerms(); + $search = $this->searchObject->getParams()->getSearchTerms(); if (isset($search[0]['lookfor'])) { $author = $search[0]['lookfor']; // remove quotes diff --git a/module/VuFind/src/VuFind/Recommend/AuthorityRecommend.php b/module/VuFind/src/VuFind/Recommend/AuthorityRecommend.php index 27b4f2dc322..ab8fdd2e94c 100644 --- a/module/VuFind/src/VuFind/Recommend/AuthorityRecommend.php +++ b/module/VuFind/src/VuFind/Recommend/AuthorityRecommend.php @@ -108,7 +108,7 @@ class AuthorityRecommend implements RecommendInterface public function process($results) { // function will return blank on Advanced Search - if ($results->getSearchType()== 'advanced') { + if ($results->getParams()->getSearchType()== 'advanced') { return; } diff --git a/module/VuFind/src/VuFind/Recommend/PubDateVisAjax.php b/module/VuFind/src/VuFind/Recommend/PubDateVisAjax.php index a186707982c..0fcf809af24 100644 --- a/module/VuFind/src/VuFind/Recommend/PubDateVisAjax.php +++ b/module/VuFind/src/VuFind/Recommend/PubDateVisAjax.php @@ -114,7 +114,7 @@ class PubDateVisAjax implements RecommendInterface public function getVisFacets() { return $this->processDateFacets( - $this->searchObject->getFilters() + $this->searchObject->getParams()->getFilters() ); } @@ -180,7 +180,7 @@ class PubDateVisAjax implements RecommendInterface } $result[$current] = array($from, $to); $result[$current]['label'] - = $this->searchObject->getFacetLabel($current); + = $this->searchObject->getParams()->getFacetLabel($current); } return $result; } diff --git a/module/VuFind/src/VuFind/Recommend/SideFacets.php b/module/VuFind/src/VuFind/Recommend/SideFacets.php index 47e987e4251..1ed92c9afc8 100644 --- a/module/VuFind/src/VuFind/Recommend/SideFacets.php +++ b/module/VuFind/src/VuFind/Recommend/SideFacets.php @@ -142,7 +142,7 @@ class SideFacets implements RecommendInterface */ public function getDateFacets() { - $filters = $this->results->getFilters(); + $filters = $this->results->getParams()->getFilters(); $result = array(); foreach ($this->dateFacets as $current) { $from = $to = ''; diff --git a/module/VuFind/src/VuFind/Recommend/SummonDatabases.php b/module/VuFind/src/VuFind/Recommend/SummonDatabases.php index a0f4b4f5916..b5fabcfcc06 100644 --- a/module/VuFind/src/VuFind/Recommend/SummonDatabases.php +++ b/module/VuFind/src/VuFind/Recommend/SummonDatabases.php @@ -96,7 +96,7 @@ class SummonDatabases implements RecommendInterface // If we received a Summon search object, we'll use that. If not, we need // to create a new Summon search object using the specified request // parameter for search terms. - if ($results->getSearchClassId() != 'Summon') { + if ($results->getParams()->getSearchClassId() != 'Summon') { $params = new SummonParams(); $params->setBasicSearch($this->lookfor); $results = new SummonResults($params); diff --git a/module/VuFind/src/VuFind/Recommend/SwitchType.php b/module/VuFind/src/VuFind/Recommend/SwitchType.php index c4003f54131..4753020aeb6 100644 --- a/module/VuFind/src/VuFind/Recommend/SwitchType.php +++ b/module/VuFind/src/VuFind/Recommend/SwitchType.php @@ -95,7 +95,7 @@ class SwitchType implements RecommendInterface */ public function process($results) { - $handler = $results->getSearchHandler(); + $handler = $results->getParams()->getSearchHandler(); // If the handler is null, we can't figure out a single handler, so this // is probably an advanced search. In that case, we shouldn't try to change diff --git a/module/VuFind/src/VuFind/Recommend/WorldCatIdentities.php b/module/VuFind/src/VuFind/Recommend/WorldCatIdentities.php index 92585eab999..7f80a48cc5f 100644 --- a/module/VuFind/src/VuFind/Recommend/WorldCatIdentities.php +++ b/module/VuFind/src/VuFind/Recommend/WorldCatIdentities.php @@ -100,7 +100,7 @@ class WorldCatIdentities implements RecommendInterface public function getIdentities() { // Extract the first search term from the search object: - $search = $this->searchObject->getSearchTerms(); + $search = $this->searchObject->getParams()->getSearchTerms(); $lookfor = isset($search[0]['lookfor']) ? $search[0]['lookfor'] : ''; // Get terminology information: diff --git a/module/VuFind/src/VuFind/Recommend/WorldCatTerms.php b/module/VuFind/src/VuFind/Recommend/WorldCatTerms.php index 107ad4cc73f..9c8884d4a80 100644 --- a/module/VuFind/src/VuFind/Recommend/WorldCatTerms.php +++ b/module/VuFind/src/VuFind/Recommend/WorldCatTerms.php @@ -101,7 +101,7 @@ class WorldCatTerms implements RecommendInterface public function getTerms() { // Extract the first search term from the search object: - $search = $this->searchObject->getSearchTerms(); + $search = $this->searchObject->getParams()->getSearchTerms(); $lookfor = isset($search[0]['lookfor']) ? $search[0]['lookfor'] : ''; // Get terminology information: diff --git a/module/VuFind/src/VuFind/Search/Base/Results.php b/module/VuFind/src/VuFind/Search/Base/Results.php index d050425a9cc..749a8131c98 100644 --- a/module/VuFind/src/VuFind/Search/Base/Results.php +++ b/module/VuFind/src/VuFind/Search/Base/Results.php @@ -216,24 +216,6 @@ abstract class Results return $retVal; } - /** - * Allow Results object to proxy methods of Params object. - * - * @param string $methodName Method to call - * @param array $params Method parameters - * - * @return mixed - */ - public function __call($methodName, $params) - { - // Proxy undefined methods to the parameter object: - $method = array($this->getParams(), $methodName); - if (!is_callable($method)) { - throw new \Exception($methodName . ' cannot be called.'); - } - return call_user_func_array($method, $params); - } - /** * Get spelling suggestion information. * @@ -280,7 +262,8 @@ abstract class Results if (!is_null($this->startRecordOverride)) { return $this->startRecordOverride; } - return (($this->getPage() - 1) * $this->getLimit()) + 1; + $params = $this->getParams(); + return (($params->getPage() - 1) * $params->getLimit()) + 1; } /** @@ -291,8 +274,8 @@ abstract class Results public function getEndRecord() { $total = $this->getResultTotal(); - $limit = $this->getLimit(); - $page = $this->getPage(); + $limit = $this->getParams()->getLimit(); + $page = $this->getParams()->getPage(); if ($page * $limit > $total) { // The end of the current page runs past the last record, use total // results @@ -427,8 +410,8 @@ abstract class Results // Build the standard paginator control: return Paginator::factory($total) - ->setCurrentPageNumber($this->getPage()) - ->setItemCountPerPage($this->getLimit()) + ->setCurrentPageNumber($this->getParams()->getPage()) + ->setItemCountPerPage($this->getParams()->getLimit()) ->setPageRange(11); } @@ -513,4 +496,21 @@ abstract class Results $this->queryTime = $minified->s; $this->resultTotal = $minified->r; } + + /** + * Get an array of recommendation objects for augmenting the results display. + * + * @param string $location Name of location to use as a filter (null to get + * associative array of all locations); legal non-null values: 'top', 'side' + * + * @return array + */ + public function getRecommendations($location = 'top') + { + // Proxy the params object's getRecommendations call -- we need to set up + // the recommendations in the params object since they need to be + // query-aware, but from a caller's perspective, it makes more sense to + // pull them from the results object. + return $this->getParams()->getRecommendations($location); + } } \ No newline at end of file diff --git a/module/VuFind/src/VuFind/Search/Favorites/Results.php b/module/VuFind/src/VuFind/Search/Favorites/Results.php index 3954b33c72f..2fcd1ded939 100644 --- a/module/VuFind/src/VuFind/Search/Favorites/Results.php +++ b/module/VuFind/src/VuFind/Search/Favorites/Results.php @@ -125,7 +125,7 @@ class Results extends BaseResults protected function performSearch() { $list = $this->getListObject(); - $account = $this->getAuthManager(); + $account = $this->getParams()->getAuthManager(); $this->user = $account ? $account->isLoggedIn() : false; // Make sure the user and/or list objects make it possible to view @@ -149,16 +149,16 @@ class Results extends BaseResults $userId = is_null($list) ? $this->user->id : $list->user_id; $listId = is_null($list) ? null : $list->id; $rawResults = $resource->getFavorites( - $userId, $listId, $this->getTagFilters(), $this->getSort() + $userId, $listId, $this->getTagFilters(), $this->getParams()->getSort() ); $this->resultTotal = count($rawResults); // Apply offset and limit if necessary! - $limit = $this->getLimit(); + $limit = $this->getParams()->getLimit(); if ($this->resultTotal > $limit) { $rawResults = $resource->getFavorites( - $userId, $listId, $this->getTagFilters(), $this->getSort(), - $this->getStartRecord() - 1, $limit + $userId, $listId, $this->getTagFilters(), + $this->getParams()->getSort(), $this->getStartRecord() - 1, $limit ); } diff --git a/module/VuFind/src/VuFind/Search/Minified.php b/module/VuFind/src/VuFind/Search/Minified.php index a05fc4e86f5..54feccf4505 100644 --- a/module/VuFind/src/VuFind/Search/Minified.php +++ b/module/VuFind/src/VuFind/Search/Minified.php @@ -77,11 +77,11 @@ class Minified $this->i = $searchObject->getStartTime(); $this->s = $searchObject->getQuerySpeed(); $this->r = $searchObject->getResultTotal(); - $this->ty = $searchObject->getSearchType(); - $this->cl = $searchObject->getSearchClassId(); + $this->ty = $searchObject->getParams()->getSearchType(); + $this->cl = $searchObject->getParams()->getSearchClassId(); // Search terms, we'll shorten keys - $tempTerms = $searchObject->getSearchTerms(); + $tempTerms = $searchObject->getParams()->getSearchTerms(); foreach ($tempTerms as $term) { $newTerm = array(); foreach ($term as $k => $v) { @@ -122,7 +122,7 @@ class Minified // It would be nice to shorten filter fields too, but // it would be a nightmare to maintain. - $this->f = $searchObject->getFilters(); + $this->f = $searchObject->getParams()->getFilters(); } /** diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php index 844e091a670..abb096d8471 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Params.php +++ b/module/VuFind/src/VuFind/Search/Solr/Params.php @@ -175,7 +175,7 @@ class Params extends BaseParams * * @return void */ - public function initTagSearch() + protected function initTagSearch() { $table = new TagsTable(); $tag = $table->getByText($this->getDisplayQuery()); diff --git a/module/VuFind/src/VuFind/Search/Solr/Results.php b/module/VuFind/src/VuFind/Search/Solr/Results.php index ab4ad29e2ed..e12128633ee 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Results.php +++ b/module/VuFind/src/VuFind/Search/Solr/Results.php @@ -91,19 +91,21 @@ class Results extends BaseResults */ protected function performSearch() { - $solr = static::getSolrConnection($this->getSelectedShards()); + $solr = static::getSolrConnection($this->getParams()->getSelectedShards()); // Collect the search parameters: - $overrideQuery = $this->getOverrideQuery(); + $overrideQuery = $this->getParams()->getOverrideQuery(); $params = array( 'query' => !empty($overrideQuery) - ? $overrideQuery : $solr->buildQuery($this->getSearchTerms()), - 'handler' => $this->getSearchHandler(), + ? $overrideQuery + : $solr->buildQuery($this->getParams()->getSearchTerms()), + 'handler' => $this->getParams()->getSearchHandler(), // Account for reserved VuFind word 'relevance' (which really means // "no sort parameter in Solr"): - 'sort' => $this->getSort() == 'relevance' ? null : $this->getSort(), + 'sort' => $this->getParams()->getSort() == 'relevance' + ? null : $this->getParams()->getSort(), 'start' => $this->getStartRecord() - 1, - 'limit' => $this->getLimit(), + 'limit' => $this->getParams()->getLimit(), 'facet' => $this->getParams()->getFacetSettings(), 'filter' => $this->getParams()->getFilterSettings(), 'spell' => $this->getParams()->getSpellingQuery(), @@ -173,7 +175,7 @@ class Results extends BaseResults // Make sure the suggestion is for a valid search term. // Sometimes shingling will have bridged two search fields (in // an advanced search) or skipped over a stopword. - if (!$this->findSearchTerm($ourTerm)) { + if (!$this->getParams()->findSearchTerm($ourTerm)) { $validTerm = false; } @@ -221,7 +223,7 @@ class Results extends BaseResults } foreach ($termList as $term) { - if (!$this->findSearchTerm($term['word'])) { + if (!$this->getParams()->findSearchTerm($term['word'])) { $newList[] = $term; } } @@ -350,7 +352,7 @@ class Results extends BaseResults } // Do we need to show the whole, modified query? if ($config->Spelling->phrase) { - $label = $this->getDisplayQueryWithReplacedTerm( + $label = $this->getParams()->getDisplayQueryWithReplacedTerm( $targetTerm, $replacement ); } else { @@ -511,7 +513,7 @@ class Results extends BaseResults */ public function getSimilarRecords($id) { - $solr = static::getSolrConnection($this->getSelectedShards()); + $solr = static::getSolrConnection($this->getParams()->getSelectedShards()); $filters = $this->getOptions()->getHiddenFilters(); $extras = empty($filters) ? array() : array('fq' => $filters); $rawResponse = $solr->getMoreLikeThis($id, $extras); @@ -568,14 +570,14 @@ class Results extends BaseResults $clone = clone($this); // Manipulate facet settings temporarily: - $clone->resetFacetConfig(); - $clone->setFacetLimit(-1); + $clone->getParams()->resetFacetConfig(); + $clone->getParams()->setFacetLimit(-1); foreach ($facetfields as $facetName) { - $clone->addFacet($facetName); + $clone->getParams()->addFacet($facetName); // Clear existing filters for the selected field if necessary: if ($removeFilter) { - $clone->removeAllFilters($facetName); + $clone->getParams()->removeAllFilters($facetName); } } diff --git a/module/VuFind/src/VuFind/Search/SolrAuthorFacets/Results.php b/module/VuFind/src/VuFind/Search/SolrAuthorFacets/Results.php index 57c44513f80..2793e10efe4 100644 --- a/module/VuFind/src/VuFind/Search/SolrAuthorFacets/Results.php +++ b/module/VuFind/src/VuFind/Search/SolrAuthorFacets/Results.php @@ -52,8 +52,8 @@ class Results extends SolrResults // Collect the search parameters: $params = array( - 'query' => $solr->buildQuery($this->getSearchTerms()), - 'handler' => $this->getSearchHandler(), + 'query' => $solr->buildQuery($this->getParams()->getSearchTerms()), + 'handler' => $this->getParams()->getSearchHandler(), 'limit' => 0, 'facet' => $this->getParams()->getFacetSettings(), ); @@ -64,11 +64,12 @@ class Results extends SolrResults // Get the facets from which we will build our results: $facets = $this->getFacetList(array('authorStr' => null)); if (isset($facets['authorStr'])) { + $params = $this->getParams(); $this->resultTotal - = (($this->getPage() - 1) * $this->getLimit()) + = (($params->getPage() - 1) * $params->getLimit()) + count($facets['authorStr']['list']); $this->results = array_slice( - $facets['authorStr']['list'], 0, $this->getLimit() + $facets['authorStr']['list'], 0, $params->getLimit() ); } } diff --git a/module/VuFind/src/VuFind/Search/Summon/Results.php b/module/VuFind/src/VuFind/Search/Summon/Results.php index 2883026873d..89b374bc621 100644 --- a/module/VuFind/src/VuFind/Search/Summon/Results.php +++ b/module/VuFind/src/VuFind/Search/Summon/Results.php @@ -81,7 +81,7 @@ class Results extends BaseResults // Perform the actual search $summon = self::getSummonConnection(); $query = new SummonQuery( - $summon->buildQuery($this->getSearchTerms()), + $summon->buildQuery($this->getParams()->getSearchTerms()), array( 'sort' => $finalSort, 'pageNumber' => $this->getParams()->getPage(), diff --git a/module/VuFind/src/VuFind/Search/Tags/Results.php b/module/VuFind/src/VuFind/Search/Tags/Results.php index bbf1918514d..9ec276ec1b4 100644 --- a/module/VuFind/src/VuFind/Search/Tags/Results.php +++ b/module/VuFind/src/VuFind/Search/Tags/Results.php @@ -49,9 +49,9 @@ class Results extends BaseResults protected function performSearch() { $table = new TagsTable(); - $tag = $table->getByText($this->getDisplayQuery()); + $tag = $table->getByText($this->getParams()->getDisplayQuery()); if (!empty($tag)) { - $rawResults = $tag->getResources(null, $this->getSort()); + $rawResults = $tag->getResources(null, $this->getParams()->getSort()); } else { $rawResults = array(); } @@ -60,10 +60,11 @@ class Results extends BaseResults $this->resultTotal = count($rawResults); // Apply offset and limit if necessary! - $limit = $this->getLimit(); + $limit = $this->getParams()->getLimit(); if ($this->resultTotal > $limit) { $rawResults = $tag->getResources( - null, $this->getSort(), $this->getStartRecord() - 1, $limit + null, $this->getParams()->getSort(), $this->getStartRecord() - 1, + $limit ); } diff --git a/module/VuFind/src/VuFind/Search/UrlHelper.php b/module/VuFind/src/VuFind/Search/UrlHelper.php index f0742f809d7..ba4b44e117a 100644 --- a/module/VuFind/src/VuFind/Search/UrlHelper.php +++ b/module/VuFind/src/VuFind/Search/UrlHelper.php @@ -87,8 +87,8 @@ class UrlHelper $params = $this->defaultParams; // Build all the URL parameters based on search object settings: - if ($this->results->getSearchType() == 'advanced') { - $terms = $this->results->getSearchTerms(); + if ($this->results->getParams()->getSearchType() == 'advanced') { + $terms = $this->results->getParams()->getSearchTerms(); if (isset($terms[0]['join'])) { $params['join'] = $terms[0]['join']; } @@ -108,35 +108,37 @@ class UrlHelper } } } else { - $search = $this->results->getDisplayQuery(); + $search = $this->results->getParams()->getDisplayQuery(); if (!empty($search)) { $params[$this->basicSearchParam] = $search; } - $type = $this->results->getSearchHandler(); + $type = $this->results->getParams()->getSearchHandler(); if (!empty($type)) { $params['type'] = $type; } } - $sort = $this->results->getSort(); - if (!is_null($sort) && $sort != $this->results->getDefaultSort()) { + $sort = $this->results->getParams()->getSort(); + if (!is_null($sort) + && $sort != $this->results->getParams()->getDefaultSort() + ) { $params['sort'] = $sort; } - $limit = $this->results->getLimit(); + $limit = $this->results->getParams()->getLimit(); if (!is_null($limit) && $limit != $this->results->getOptions()->getDefaultLimit() ) { $params['limit'] = $limit; } - $view = $this->results->getView(); + $view = $this->results->getParams()->getView(); if (!is_null($view) && $view != $this->results->getOptions()->getDefaultView() ) { $params['view'] = $view; } - if ($this->results->getPage() != 1) { - $params['page'] = $this->results->getPage(); + if ($this->results->getParams()->getPage() != 1) { + $params['page'] = $this->results->getParams()->getPage(); } - $filters = $this->results->getFilters(); + $filters = $this->results->getParams()->getFilters(); if (!empty($filters)) { $params['filter'] = array(); foreach ($filters as $field => $values) { @@ -145,7 +147,7 @@ class UrlHelper } } } - $shards = $this->results->getSelectedShards(); + $shards = $this->results->getParams()->getSelectedShards(); if (!empty($shards)) { sort($shards); $key = implode(':::', $shards); @@ -171,7 +173,7 @@ class UrlHelper public function replaceTerm($from, $to) { $newResults = clone($this->results); - $newResults->replaceSearchTerm($from, $to); + $newResults->getParams()->replaceSearchTerm($from, $to); $myClass = get_class($this); $helper = new $myClass($newResults); return $helper->getParams(); @@ -244,7 +246,7 @@ class UrlHelper if (isset($params['filter']) && is_array($params['filter'])) { foreach ($params['filter'] as $current) { list($currentField, $currentValue) - = $this->results->parseFilter($current); + = $this->results->getParams()->parseFilter($current); if ($currentField != $field || $currentValue != $value) { $newFilter[] = $current; } @@ -273,7 +275,7 @@ class UrlHelper public function removeFilter($filter, $escape = true) { // Treat this as a special case of removeFacet: - list($field, $value) = $this->results->parseFilter($filter); + list($field, $value) = $this->results->getParams()->parseFilter($filter); return $this->removeFacet($field, $value, $escape); } @@ -302,7 +304,7 @@ class UrlHelper public function setSort($s, $escape = true) { return $this->updateQueryString( - 'sort', $s, $this->results->getDefaultSort(), $escape + 'sort', $s, $this->results->getParams()->getDefaultSort(), $escape ); } diff --git a/module/VuFind/src/VuFind/Search/WorldCat/Results.php b/module/VuFind/src/VuFind/Search/WorldCat/Results.php index 37b1f2d6ec9..930a663fbd9 100644 --- a/module/VuFind/src/VuFind/Search/WorldCat/Results.php +++ b/module/VuFind/src/VuFind/Search/WorldCat/Results.php @@ -71,14 +71,14 @@ class Results extends BaseResults // Collect the search parameters: $config = ConfigReader::getConfig(); $wc = static::getWorldCatConnection(); - $overrideQuery = $this->getOverrideQuery(); + $overrideQuery = $this->getParams()->getOverrideQuery(); $query = empty($overrideQuery) - ? $wc->buildQuery($this->getSearchTerms()) : $overrideQuery; + ? $wc->buildQuery($this->getParams()->getSearchTerms()) : $overrideQuery; // Perform the search: $this->rawResponse = $wc->search( - $query, $config->WorldCat->OCLCCode, $this->getPage(), $this->getLimit(), - $this->getSort() + $query, $config->WorldCat->OCLCCode, $this->getParams()->getPage(), + $this->getParams()->getLimit(), $this->getParams()->getSort() ); // How many results were there? diff --git a/module/VuFind/src/VuFind/Statistics/Search.php b/module/VuFind/src/VuFind/Statistics/Search.php index d6eefca84d8..9046265fc6d 100644 --- a/module/VuFind/src/VuFind/Statistics/Search.php +++ b/module/VuFind/src/VuFind/Statistics/Search.php @@ -48,11 +48,10 @@ class Search extends AbstractBase */ public function log($data, $request) { - $configs = $data->getFacetConfig(); $stat = array( - 'phrase' => $data->getDisplayQuery(), - 'searchSource' => $data->getSearchClassId(), - 'type' => $data->getSearchHandler(), + 'phrase' => $data->getParams()->getDisplayQuery(), + 'searchSource' => $data->getParams()->getSearchClassId(), + 'type' => $data->getParams()->getSearchHandler(), 'resultCount' => $data->getResultTotal(), 'noresults' => $data->getResultTotal() == 0 ); diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/ResultFeed.php b/module/VuFind/src/VuFind/Theme/Root/Helper/ResultFeed.php index f7074f14d46..881672dc64d 100644 --- a/module/VuFind/src/VuFind/Theme/Root/Helper/ResultFeed.php +++ b/module/VuFind/src/VuFind/Theme/Root/Helper/ResultFeed.php @@ -109,11 +109,13 @@ class ResultFeed extends AbstractHelper $feed = new Feed(); $translator = $this->getTranslator(); $feed->setTitle( - $translator('Results for') . ' ' . $results->getDisplayQuery() + $translator('Results for') . ' ' + . $results->getParams()->getDisplayQuery() ); $feed->setLink($baseUrl . $results->getUrl()->setViewParam(null, false)); $feed->setFeedLink( - $baseUrl . $results->getUrl()->getParams(false), $results->getView() + $baseUrl . $results->getUrl()->getParams(false), + $results->getParams()->getView() ); $records = $results->getResults(); diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/SortFacetList.php b/module/VuFind/src/VuFind/Theme/Root/Helper/SortFacetList.php index 18d8b00ee21..cc1ab1de2ca 100644 --- a/module/VuFind/src/VuFind/Theme/Root/Helper/SortFacetList.php +++ b/module/VuFind/src/VuFind/Theme/Root/Helper/SortFacetList.php @@ -56,7 +56,7 @@ class SortFacetList extends AbstractHelper { $facets = array(); // avoid limit on URL - $results->setLimit($results->getOptions()->getDefaultLimit()); + $results->getParams()->setLimit($results->getOptions()->getDefaultLimit()); $urlHelper = $this->getView()->plugin('url'); foreach ($list as $value) { $url = $urlHelper($searchRoute) diff --git a/themes/blueprint/templates/Recommend/AuthorityRecommend.phtml b/themes/blueprint/templates/Recommend/AuthorityRecommend.phtml index 6697ae2ee40..4b56a3ab466 100644 --- a/themes/blueprint/templates/Recommend/AuthorityRecommend.phtml +++ b/themes/blueprint/templates/Recommend/AuthorityRecommend.phtml @@ -6,7 +6,7 @@ <? // Generate a new search URL that replaces the user's current term with the authority term: $url = $this->url($this->results->getOptions()->getSearchAction()) - . $this->results->getUrl()->replaceTerm($this->results->getDisplayQuery(), $data[$i]['heading']); + . $this->results->getUrl()->replaceTerm($this->results->getParams()->getDisplayQuery(), $data[$i]['heading']); ?> <a href="<?=$url?>"><?=$this->escapeHtml($data[$i]['heading'])?></a><? if ($i != count($data) - 1): ?>, <? endif; ?> <? endfor; ?> diff --git a/themes/blueprint/templates/Recommend/FavoriteFacets.phtml b/themes/blueprint/templates/Recommend/FavoriteFacets.phtml index fe16419465f..f2454e52e13 100644 --- a/themes/blueprint/templates/Recommend/FavoriteFacets.phtml +++ b/themes/blueprint/templates/Recommend/FavoriteFacets.phtml @@ -22,7 +22,7 @@ <? if (isset($sideFacetSet['tags']) && !empty($sideFacetSet['tags']['list'])): ?> <div class="sidegroup"> <h4 class="tag"><?=$this->transEsc($sideFacetSet['tags']['label'])?></h4> - <? $filterList = $this->results->getFilterList(true); + <? $filterList = $this->results->getParams()->getFilterList(true); $tagFilterList = isset($filterList[$sideFacetSet['tags']['label']]) ? $filterList[$sideFacetSet['tags']['label']] : null; if (!empty($tagFilterList)): ?> <strong><?=$this->transEsc('Remove Filters')?></strong> diff --git a/themes/blueprint/templates/Recommend/SideFacets.phtml b/themes/blueprint/templates/Recommend/SideFacets.phtml index 58f3bb66041..68615198c0a 100644 --- a/themes/blueprint/templates/Recommend/SideFacets.phtml +++ b/themes/blueprint/templates/Recommend/SideFacets.phtml @@ -1,6 +1,6 @@ <div class="sidegroup"> <? if ($this->results->getResultTotal() > 0): ?><h4><?=$this->transEsc('Narrow Search')?></h4><? endif; ?> - <? $checkboxFilters = $this->results->getCheckboxFacets(); if (count($checkboxFilters) > 0): ?> + <? $checkboxFilters = $this->results->getParams()->getCheckboxFacets(); if (count($checkboxFilters) > 0): ?> <? foreach ($checkboxFilters as $current): ?> <div class="checkboxFilter<?=($this->results->getResultTotal() < 1 && !$current['selected'] && !$current['alwaysVisible']) ? ' hide' : ''?>"> <input type="checkbox" name="filter[]" value="<?=$this->escapeHtml($current['filter'])?>" @@ -10,7 +10,7 @@ </div> <? endforeach; ?> <? endif; ?> - <? $filterList = $this->results->getFilterList(true); if (!empty($filterList)): ?> + <? $filterList = $this->results->getParams()->getFilterList(true); if (!empty($filterList)): ?> <strong><?=$this->transEsc('Remove Filters')?></strong> <ul class="filters"> <? foreach ($filterList as $field => $filters): ?> diff --git a/themes/blueprint/templates/author/results.phtml b/themes/blueprint/templates/author/results.phtml index 76f90ba9081..f3f1b4ce64b 100644 --- a/themes/blueprint/templates/author/results.phtml +++ b/themes/blueprint/templates/author/results.phtml @@ -11,5 +11,5 @@ $this->layout()->searchbox = $this->render('search/searchbox.phtml'); // Set up breadcrumbs: - $this->layout()->breadcrumbs = '<em>' . $this->results->getDisplayQuery() . '</em>'; + $this->layout()->breadcrumbs = '<em>' . $this->results->getParams()->getDisplayQuery() . '</em>'; ?> \ No newline at end of file diff --git a/themes/blueprint/templates/author/search.phtml b/themes/blueprint/templates/author/search.phtml index c01aedc492b..53883d4c7d5 100644 --- a/themes/blueprint/templates/author/search.phtml +++ b/themes/blueprint/templates/author/search.phtml @@ -19,5 +19,5 @@ $this->layout()->searchbox = $this->render('search/searchbox.phtml'); // Set up breadcrumbs: - $this->layout()->breadcrumbs = '<em>' . $this->translate('Author Results for') . ' ' . $this->results->getDisplayQuery() . '</em>'; + $this->layout()->breadcrumbs = '<em>' . $this->translate('Author Results for') . ' ' . $this->results->getParams()->getDisplayQuery() . '</em>'; ?> \ No newline at end of file diff --git a/themes/blueprint/templates/search/advanced/layout.phtml b/themes/blueprint/templates/search/advanced/layout.phtml index 413e2aa3374..e9354813106 100644 --- a/themes/blueprint/templates/search/advanced/layout.phtml +++ b/themes/blueprint/templates/search/advanced/layout.phtml @@ -10,8 +10,8 @@ // Set up saved search details: if (isset($this->saved) && is_object($this->saved)) { - $searchDetails = $this->saved->getSearchTerms(); - $searchFilters = $this->saved->getFilterList(); + $searchDetails = $this->saved->getParams()->getSearchTerms(); + $searchFilters = $this->saved->getParams()->getFilterList(); } else { $searchDetails = $searchFilters = false; } diff --git a/themes/blueprint/templates/search/controls/limit.phtml b/themes/blueprint/templates/search/controls/limit.phtml index 7a16a772fcd..8a7418eba47 100644 --- a/themes/blueprint/templates/search/controls/limit.phtml +++ b/themes/blueprint/templates/search/controls/limit.phtml @@ -1,5 +1,5 @@ <div class="limitSelect"> - <? $limitList = $this->results->getLimitList(); if (count($limitList) > 1): ?> + <? $limitList = $this->results->getParams()->getLimitList(); if (count($limitList) > 1): ?> <form action="<?=$this->currentPath() . $this->results->getUrl()->setLimit(null)?>" method="post"> <label for="limit"><?=$this->transEsc('Results per page')?></label> <select id="limit" name="limit" class="jumpMenu"> diff --git a/themes/blueprint/templates/search/controls/sort.phtml b/themes/blueprint/templates/search/controls/sort.phtml index bee9ce176c8..471969b10a0 100644 --- a/themes/blueprint/templates/search/controls/sort.phtml +++ b/themes/blueprint/templates/search/controls/sort.phtml @@ -1,8 +1,8 @@ -<? $list = $this->results->getSortList(); if (!empty($list)): ?> +<? $list = $this->results->getParams()->getSortList(); if (!empty($list)): ?> <form action="<?=$this->currentPath() . $this->results->getUrl()->setSort(null)?>" method="post"> <label for="sort_options_1"><?=$this->transEsc('Sort')?></label> <select id="sort_options_1" name="sort" class="jumpMenu"> - <? foreach ($this->results->getSortList() as $sortType => $sortData): ?> + <? foreach ($this->results->getParams()->getSortList() as $sortType => $sortData): ?> <option value="<?=$this->escapeHtml($sortType)?>"<?=$sortData['selected']?' selected="selected"':''?>><?=$this->transEsc($sortData['desc'])?></option> <? endforeach; ?> </select> diff --git a/themes/blueprint/templates/search/controls/view.phtml b/themes/blueprint/templates/search/controls/view.phtml index 29dc467d018..748df8496e4 100644 --- a/themes/blueprint/templates/search/controls/view.phtml +++ b/themes/blueprint/templates/search/controls/view.phtml @@ -1,5 +1,5 @@ <div class="viewButtons"> -<? $viewList = $this->results->getViewList(); if (count($viewList) > 1): ?> +<? $viewList = $this->results->getParams()->getViewList(); if (count($viewList) > 1): ?> <? foreach ($viewList as $viewType => $viewData): ?> <? if (!$viewData['selected']): ?> <a href="<?=$this->results->getUrl()->setViewParam($viewType)?>" title="<?=$this->transEsc('Switch view to')?> <?=$this->transEsc($viewData['desc'])?>" > diff --git a/themes/blueprint/templates/search/history-table.phtml b/themes/blueprint/templates/search/history-table.phtml index 9bd65130976..fe1efc84633 100644 --- a/themes/blueprint/templates/search/history-table.phtml +++ b/themes/blueprint/templates/search/history-table.phtml @@ -11,12 +11,12 @@ <td><?=$this->escapeHtml(date("g:ia, jS M y", $info->getStartTime()))?></td> <td> <a href="<?=$this->url($info->getOptions()->getSearchAction()) . $info->getUrl()->getParams()?>"><? - $desc = $info->getDisplayQuery(); + $desc = $info->getParams()->getDisplayQuery(); echo empty($desc) ? $this->transEsc("history_empty_search") : $this->escapeHtml($desc); ?></a> </td> <td> - <? $info->activateAllFacets(); foreach ($info->getFilterList() as $field => $filters): ?> + <? $info->getParams()->activateAllFacets(); foreach ($info->getParams()->getFilterList() as $field => $filters): ?> <? foreach ($filters as $filter): ?> <strong><?=$this->transEsc($field)?></strong>: <?=$this->escapeHtml($filter['displayText'])?><br/> <? endforeach; ?> diff --git a/themes/blueprint/templates/search/reservessearch.phtml b/themes/blueprint/templates/search/reservessearch.phtml index 864291f9448..3d82dcca64f 100644 --- a/themes/blueprint/templates/search/reservessearch.phtml +++ b/themes/blueprint/templates/search/reservessearch.phtml @@ -6,7 +6,7 @@ $this->layout()->breadcrumbs = '<em>' . $this->transEsc('Reserves') . '</em>'; // Convenience variables: - $reservesLookfor = $this->results->getDisplayQuery(); + $reservesLookfor = $this->results->getParams()->getDisplayQuery(); ?> <div class="<?=$this->layoutClass('mainbody')?>"> diff --git a/themes/blueprint/templates/search/results.phtml b/themes/blueprint/templates/search/results.phtml index 2a686805a96..b1fb418397d 100644 --- a/themes/blueprint/templates/search/results.phtml +++ b/themes/blueprint/templates/search/results.phtml @@ -1,6 +1,6 @@ <? // Set up page title: - $lookfor = $this->results->getDisplayQuery(); + $lookfor = $this->results->getParams()->getDisplayQuery(); if (isset($this->overrideTitle)) { $this->headTitle($this->overrideTitle); } else { @@ -12,13 +12,13 @@ 'search/searchbox.phtml', array( 'lookfor' => $lookfor, - 'searchIndex' => $this->results->getSearchHandler(), - 'searchType' => $this->results->getSearchType(), + 'searchIndex' => $this->results->getParams()->getSearchHandler(), + 'searchType' => $this->results->getParams()->getSearchType(), 'searchId' => $this->results->getSearchId(), - 'searchClassId' => $this->results->getsearchClassId(), - 'checkboxFilters' => $this->results->getCheckboxFacets(), - 'filterList' => $this->results->getFilters(), - 'selectedShards' => $this->results->getSelectedShards() + 'searchClassId' => $this->results->getParams()->getsearchClassId(), + 'checkboxFilters' => $this->results->getParams()->getCheckboxFacets(), + 'filterList' => $this->results->getParams()->getFilters(), + 'selectedShards' => $this->results->getParams()->getSelectedShards() ) ); @@ -51,7 +51,7 @@ <? endif; ?> <? if (isset($this->overrideSearchHeading)): ?> <?=$this->overrideSearchHeading?> - <? elseif ($this->results->getSearchType() == 'basic'): ?> + <? elseif ($this->results->getParams()->getSearchType() == 'basic'): ?> <?=$this->transEsc('for search')?>: <strong>'<?=$this->escapeHtml($lookfor)?>'</strong>, <? endif; ?> <? if ($qtime = $this->results->getQuerySpeed()): ?> @@ -95,7 +95,7 @@ <? else: ?> <form method="post" name="bulkActionForm" action="<?=$this->url('cart-home')?>"> <?=$this->context($this)->renderInContext('search/bulk-action-buttons.phtml', array('idPrefix' => ''))?> - <?=$this->render('search/list-' . $this->results->getView() . '.phtml')?> + <?=$this->render('search/list-' . $this->results->getParams()->getView() . '.phtml')?> <?=$this->context($this)->renderInContext('search/bulk-action-buttons.phtml', array('idPrefix' => 'bottom_'))?> <?=$this->paginationControl($this->results->getPaginator(), 'Sliding', 'search/pagination.phtml', array('results' => $this->results))?> </form> diff --git a/themes/jquerymobile/templates/Recommend/SideFacets.phtml b/themes/jquerymobile/templates/Recommend/SideFacets.phtml index 495dc509925..cfbf2037e29 100644 --- a/themes/jquerymobile/templates/Recommend/SideFacets.phtml +++ b/themes/jquerymobile/templates/Recommend/SideFacets.phtml @@ -1,4 +1,4 @@ -<? $filterList = $this->results->getFilterList(true); if (!empty($filterList)): ?> +<? $filterList = $this->results->getParams()->getFilterList(true); if (!empty($filterList)): ?> <ul class="filters" data-role="listview" data-inset="true" data-dividertheme="e"> <li data-role="list-divider"><?=$this->transEsc('adv_search_filters')?></li> <? $i = 0; foreach ($filterList as $field => $filters): ?> diff --git a/themes/jquerymobile/templates/search/history-table.phtml b/themes/jquerymobile/templates/search/history-table.phtml index 1a58c6db14a..f87013965ff 100644 --- a/themes/jquerymobile/templates/search/history-table.phtml +++ b/themes/jquerymobile/templates/search/history-table.phtml @@ -3,12 +3,12 @@ <a rel="external" href="<?=$this->url($info->getOptions()->getSearchAction()) . $info->getUrl()->getParams()?>"> <div class="result"> <h3><? - $desc = $info->getDisplayQuery(); + $desc = $info->getParams()->getDisplayQuery(); echo empty($desc) ? $this->transEsc("history_empty_search") : $this->escapeHtml($desc); ?></h3> <span class="ui-li-count"><?=$this->escapeHtml(number_format($info->getResultTotal()))?></span> <p><strong><?=$this->transEsc("history_time")?></strong>: <?=$this->escapeHtml(date("g:ia, jS M y", $info->getStartTime()))?></p> - <? $info->activateAllFacets(); foreach ($info->getFilterList() as $field => $filters): ?> + <? $info->getParams()->activateAllFacets(); foreach ($info->getParams()->getFilterList() as $field => $filters): ?> <? foreach ($filters as $filter): ?> <p><strong><?=$this->transEsc($field)?></strong>: <?=$this->escapeHtml($filter['displayText'])?></p> <? endforeach; ?> diff --git a/themes/jquerymobile/templates/search/reservessearch.phtml b/themes/jquerymobile/templates/search/reservessearch.phtml index d6852988beb..07b619c201a 100644 --- a/themes/jquerymobile/templates/search/reservessearch.phtml +++ b/themes/jquerymobile/templates/search/reservessearch.phtml @@ -3,7 +3,7 @@ $this->headTitle($this->translate('Reserves Search')); // Convenience variables: - $reservesLookfor = $this->results->getDisplayQuery(); + $reservesLookfor = $this->results->getParams()->getDisplayQuery(); ?> <div data-role="page"> diff --git a/themes/jquerymobile/templates/search/results.phtml b/themes/jquerymobile/templates/search/results.phtml index deade07738b..7a5dc451168 100644 --- a/themes/jquerymobile/templates/search/results.phtml +++ b/themes/jquerymobile/templates/search/results.phtml @@ -1,6 +1,6 @@ <? // Set up page title: - $lookfor = $this->results->getDisplayQuery(); + $lookfor = $this->results->getParams()->getDisplayQuery(); if (isset($this->overrideTitle)) { $this->headTitle($this->overrideTitle); } else { @@ -23,7 +23,7 @@ <? endif; ?> <? if (isset($this->overrideSearchHeading)): ?> <?=$this->overrideSearchHeading?> - <? elseif ($this->results->getSearchType() == 'basic'): ?> + <? elseif ($this->results->getParams()->getSearchType() == 'basic'): ?> <?=$this->transEsc('for search')?>: <strong>'<?=$this->escapeHtml($lookfor)?>'</strong> <? endif; ?> </p> @@ -48,7 +48,7 @@ <?=$this->recommend($current)?> <? endforeach; ?> <? else: ?> - <?=$this->render('search/list-' . $this->results->getView() . '.phtml')?> + <?=$this->render('search/list-' . $this->results->getParams()->getView() . '.phtml')?> <?=$this->paginationControl($this->results->getPaginator(), 'Sliding', 'search/pagination.phtml', array('results' => $this->results))?> <div data-role="controlgroup"> <a href="<?=$this->url('search-email')?>" data-role="button" rel="external"><?=$this->transEsc("Email this Search")?></a> -- GitLab