From c84ccab01c22c6a1d5e00d45aadd054751dfa530 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 2 Aug 2013 10:44:58 -0400
Subject: [PATCH] Fixed terms misconfiguration and added integration test.
 Resolves VUFIND-864.

---
 .../Factory/AbstractSolrBackendFactory.php       |  2 +-
 .../src/VuFindTest/Connection/SolrTest.php       | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
index b115fba0290..38a2758ef12 100644
--- a/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/AbstractSolrBackendFactory.php
@@ -229,7 +229,7 @@ abstract class AbstractSolrBackendFactory implements FactoryInterface
                 'defaults' => array('fl' => '*,score'),
                 'appends'  => array('fq' => array()),
             ),
-            'terms' => array(
+            'term' => array(
                 'functions' => array('terms'),
             ),
         );
diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrTest.php
index a8437127dad..f9ae374b5ff 100644
--- a/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrTest.php
+++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Connection/SolrTest.php
@@ -107,4 +107,20 @@ class SolrTest extends \VuFindTest\Unit\TestCase
          $this->assertEquals($item['count'], count($item['ids']));
          $this->assertEquals('123.46 .Q39', $item['heading']);
      }
+
+    /**
+     * Check that the terms handler is working.
+     *
+     * @return void
+     */
+    public function testTermsHandler()
+    {
+        $solr = $this->getServiceManager()->get('VuFind\Search\BackendManager')
+            ->get('Solr');
+        $currentPageInfo = $solr->terms('id', 'test', 1)->getFieldTerms('id');
+        $this->assertEquals(1, count($currentPageInfo));
+        foreach ($currentPageInfo as $key => $value) {
+            $this->assertEquals('test', substr($key, 0, 4));
+        }
+    }
 }
\ No newline at end of file
-- 
GitLab