From 5dc2dc4fa09a2c4a173d46c2aeb4b9fcc24755c3 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 23 Oct 2019 15:05:38 -0400
Subject: [PATCH] Add setting for default search backend. (#1476)

---
 config/vufind/config.ini                           | 3 +++
 themes/bootstrap3/templates/search/searchbox.phtml | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/config/vufind/config.ini b/config/vufind/config.ini
index 4fb7d522427..931a1ca8ede 100644
--- a/config/vufind/config.ini
+++ b/config/vufind/config.ini
@@ -97,6 +97,9 @@ defaultModule   = Search
 defaultLoggedInModule = MyResearch
 ; When defaultLoggedInModule is used, this action will be triggered (default = Home)
 ;defaultLoggedInAction = Home
+; The search backend that VuFind will use in search boxes when nothing else is
+; specified (e.g. on user account pages, search history, etc.). Default = Solr
+;defaultSearchBackend = Solr
 ; The route VuFind will send users to following a log out operation. Set to false
 ; or omit to attempt to retain the user's current context after log out.
 ;logOutRoute = home
diff --git a/themes/bootstrap3/templates/search/searchbox.phtml b/themes/bootstrap3/templates/search/searchbox.phtml
index 51832a3fa5a..75fd6c9e65b 100644
--- a/themes/bootstrap3/templates/search/searchbox.phtml
+++ b/themes/bootstrap3/templates/search/searchbox.phtml
@@ -1,7 +1,8 @@
 <?php
     // Set default value if necessary:
     if (!isset($this->searchClassId)) {
-        $this->searchClassId = 'Solr';
+        $config = $this->config()->get('config');
+        $this->searchClassId = $config->Site->defaultSearchBackend ?? 'Solr';
     }
 
     // Load search actions and settings (if any):
-- 
GitLab