From 4c10c429cd8ad82e2eb5594deeeff7f1545b3940 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 5 Sep 2012 14:48:29 -0400
Subject: [PATCH] Improved search manager integration for ExpandFacets
 recommendation module; also eliminated explicit \VuFind namespace reference
 in template.

---
 module/VuFind/src/VuFind/Recommend/ExpandFacets.php | 13 ++++++++++++-
 .../templates/Recommend/ExpandFacets.phtml          |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/module/VuFind/src/VuFind/Recommend/ExpandFacets.php b/module/VuFind/src/VuFind/Recommend/ExpandFacets.php
index 16a8f7151fc..b529e18d9a9 100644
--- a/module/VuFind/src/VuFind/Recommend/ExpandFacets.php
+++ b/module/VuFind/src/VuFind/Recommend/ExpandFacets.php
@@ -37,7 +37,7 @@ use VuFind\Config\Reader as ConfigReader;
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://www.vufind.org  Main Page
  */
-class ExpandFacets implements RecommendInterface
+class ExpandFacets extends AbstractSearchManagerAwareModule
 {
     protected $facets;
     protected $settings;
@@ -122,4 +122,15 @@ class ExpandFacets implements RecommendInterface
     {
         return $this->searchObject->getFacetList($this->facets);
     }
+
+    /**
+     * Get an empty search object (the template uses this as the basis for URL
+     * generation).
+     *
+     * @return \VuFind\Search\Base\Results
+     */
+    public function getEmptyResults()
+    {
+        return $this->getSearchManager()->setSearchClassId('Solr')->getResults();
+    }
 }
diff --git a/themes/blueprint/templates/Recommend/ExpandFacets.phtml b/themes/blueprint/templates/Recommend/ExpandFacets.phtml
index f2271ade128..49c0b99fb51 100644
--- a/themes/blueprint/templates/Recommend/ExpandFacets.phtml
+++ b/themes/blueprint/templates/Recommend/ExpandFacets.phtml
@@ -1,7 +1,7 @@
 <?
     $expandFacetSet = $this->recommend->getExpandedSet();
     // Get empty search object to use as basis for parameter generation below:
-    $blankResults = new \VuFind\Search\Solr\Results(new \VuFind\Search\Solr\Params());
+    $blankResults = $this->recommend->getEmptyResults();
 ?>
 <? if ($expandFacetSet): ?>
   <div class="sidegroup">
-- 
GitLab