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

Updated Summon controller with separate methods for loading advanced/homepage...

Updated Summon controller with separate methods for loading advanced/homepage facets; these currently load the same data, but this provides an integration point for separate lists consistent with VUFIND-348.
parent 65d4b162
No related merge requests found
...@@ -101,7 +101,7 @@ class SummonController extends AbstractSearch ...@@ -101,7 +101,7 @@ class SummonController extends AbstractSearch
public function homeAction() public function homeAction()
{ {
return $this->createViewModel( return $this->createViewModel(
array('results' => $this->getAdvancedFacets()) array('results' => $this->getHomePageFacets())
); );
} }
...@@ -117,8 +117,7 @@ class SummonController extends AbstractSearch ...@@ -117,8 +117,7 @@ class SummonController extends AbstractSearch
/** /**
* Return a Search Results object containing advanced facet information. This * Return a Search Results object containing advanced facet information. This
* data may come from the cache, and it is currently shared between the Home * data may come from the cache.
* page and the Advanced search screen.
* *
* @return \VuFind\Search\Summon\Results * @return \VuFind\Search\Summon\Results
*/ */
...@@ -126,7 +125,7 @@ class SummonController extends AbstractSearch ...@@ -126,7 +125,7 @@ class SummonController extends AbstractSearch
{ {
// Check if we have facet results cached, and build them if we don't. // Check if we have facet results cached, and build them if we don't.
$cache = $this->getServiceLocator()->get('CacheManager')->getCache('object'); $cache = $this->getServiceLocator()->get('CacheManager')->getCache('object');
if (!($results = $cache->getItem('summonSearchHomeFacets'))) { if (!($results = $cache->getItem('summonSearchAdvancedFacets'))) {
$sm = $this->getSearchManager(); $sm = $this->getSearchManager();
$params = $sm->setSearchClassId('Summon')->getParams(); $params = $sm->setSearchClassId('Summon')->getParams();
$params->addFacet('Language,or,1,20'); $params->addFacet('Language,or,1,20');
...@@ -142,7 +141,7 @@ class SummonController extends AbstractSearch ...@@ -142,7 +141,7 @@ class SummonController extends AbstractSearch
// Temporarily remove the service manager so we can cache the // Temporarily remove the service manager so we can cache the
// results (otherwise we'll get errors about serializing closures): // results (otherwise we'll get errors about serializing closures):
$results->unsetServiceLocator(); $results->unsetServiceLocator();
$cache->setItem('summonSearchHomeFacets', $results); $cache->setItem('summonSearchAdvancedFacets', $results);
} }
// Restore the real service locator to the object: // Restore the real service locator to the object:
...@@ -150,6 +149,18 @@ class SummonController extends AbstractSearch ...@@ -150,6 +149,18 @@ class SummonController extends AbstractSearch
return $results; return $results;
} }
/**
* Return a Search Results object containing homepage facet information. This
* data may come from the cache.
*
* @return \VuFind\Search\Summon\Results
*/
protected function getHomePageFacets()
{
// For now, we'll use the same fields as the advanced search screen.
return $this->getAdvancedFacets();
}
/** /**
* Process the facets to be used as limits on the Advanced Search screen. * Process the facets to be used as limits on the Advanced Search screen.
* *
......
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