From 8448d0fe3a573e7777e788ec8f59900f999df399 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Tue, 10 Jul 2018 14:03:53 -0400
Subject: [PATCH] Configurable authority core name.

---
 config/vufind/config.ini                             |  3 +++
 .../VuFind/Search/Factory/SolrAuthBackendFactory.php | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/config/vufind/config.ini b/config/vufind/config.ini
index 545eb9d9b09..16839227931 100644
--- a/config/vufind/config.ini
+++ b/config/vufind/config.ini
@@ -442,7 +442,10 @@ ils_encryption_key = false
 ; until one can be reached. This is only useful for advanced fault-tolerant Solr
 ; installations.
 url             = http://localhost:8080/solr
+; Default bibliographic record core
 default_core    = biblio
+; Default authority record core
+default_authority_core = authority
 ; This setting needs to match the <maxBooleanClauses> setting in your solrconfig.xml
 ; file; when VuFind has to look up large numbers of records using ID values, it may
 ; have to restrict the size of its result set based on this limitation.
diff --git a/module/VuFind/src/VuFind/Search/Factory/SolrAuthBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SolrAuthBackendFactory.php
index 38fd2b99895..089c1606ba3 100644
--- a/module/VuFind/src/VuFind/Search/Factory/SolrAuthBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/SolrAuthBackendFactory.php
@@ -48,12 +48,22 @@ class SolrAuthBackendFactory extends AbstractSolrBackendFactory
     public function __construct()
     {
         parent::__construct();
-        $this->solrCore = 'authority';
         $this->searchConfig = 'authority';
         $this->searchYaml = 'authsearchspecs.yaml';
         $this->facetConfig = 'authority';
     }
 
+    /**
+     * Get the Solr core.
+     *
+     * @return string
+     */
+    protected function getSolrCore()
+    {
+        $config = $this->config->get($this->mainConfig);
+        return $config->Index->default_authority_core ?? 'authority';
+    }
+
     /**
      * Create the SOLR backend.
      *
-- 
GitLab