From 53016af89e67425acd83d0a4606f4ea444cead4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mathias=20Maa=C3=9F?= <mathias.maass@uni-leipzig.de>
Date: Fri, 10 Mar 2023 13:38:42 +0100
Subject: [PATCH] refs #23320 [finc] delete redunant code for setting shard
 parameters

---
 .../MungerInjectionDelegatorFactory.php       | 29 -------------------
 1 file changed, 29 deletions(-)

diff --git a/module/finc/src/finc/Service/MungerInjectionDelegatorFactory.php b/module/finc/src/finc/Service/MungerInjectionDelegatorFactory.php
index ff739670b13..b7a79a099fd 100644
--- a/module/finc/src/finc/Service/MungerInjectionDelegatorFactory.php
+++ b/module/finc/src/finc/Service/MungerInjectionDelegatorFactory.php
@@ -60,11 +60,6 @@ class MungerInjectionDelegatorFactory implements DelegatorFactoryInterface
      */
     protected $preMungerConfig;
 
-    /**
-     * @var array shard configuration to register in all queries
-     */
-    protected $shards_to_register;
-
     /**
      * @var array search types to be excluded from lucene query syntax detection
      */
@@ -103,14 +98,6 @@ class MungerInjectionDelegatorFactory implements DelegatorFactoryInterface
                 }
             );
         }
-        $shards = $searchConfig->IndexShards->toArray();
-        if ($excludedShards = $searchConfig->ShardPreferences->on_user_search_only ?? null) {
-            $shards = array_diff_key($shards, array_flip(explode(',', $excludedShards)));
-        }
-        if (!empty($shards)) {
-            $this->shards_to_register = $shards;
-            $e->attach('VuFindSearch', 'pre', [$this, 'registerShards']);
-        }
         if (isset($searchConfig->General->override_advanced_lucene_detection)) {
             $this->override_advanced_lucene_detection = array_flip($searchConfig->General->override_advanced_lucene_detection->toArray());
             if (!empty($this->override_advanced_lucene_detection)) {
@@ -176,22 +163,6 @@ class MungerInjectionDelegatorFactory implements DelegatorFactoryInterface
         return true;
     }
 
-    /**
-     * Event Listener on Search/Pre that registers all configured shards for every
-     * search request
-     *
-     * @param EventInterface $event
-     *
-     * @return void
-     */
-    public function registerShards(EventInterface $event)
-    {
-        $params = $event->getParam('params');
-        if (empty($params->get('shards'))) {
-            $params->set('shards', implode(',', $this->shards_to_register));
-        }
-    }
-
     public function overrideLuceneSyntaxHelper(EventInterface $event)
     {
         $params = $event->getParams();
-- 
GitLab