DCausse has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386028 )

Change subject: Compute CirrusSearchExtraIndexBoostTemplates on the fly
......................................................................

Compute CirrusSearchExtraIndexBoostTemplates on the fly

Change-Id: I6dc9aeddb785b66dfa2007ba740ca82aea4e61bd
---
M includes/Search/SearchContext.php
M includes/Searcher.php
2 files changed, 8 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/28/386028/1

diff --git a/includes/Search/SearchContext.php 
b/includes/Search/SearchContext.php
index 2a25c1b..b05b8a9 100644
--- a/includes/Search/SearchContext.php
+++ b/includes/Search/SearchContext.php
@@ -46,11 +46,6 @@
        private $boostTemplatesFromQuery;
 
        /**
-        * @var array[] set of per-wiki template boosts from extra index 
handling
-        */
-       private $extraIndexBoostTemplates = [];
-
-       /**
         * @deprecated use rescore profiles instead
         * @var bool do we need to boost links
         */
@@ -326,16 +321,15 @@
         *  within that wiki
         */
        public function getExtraIndexBoostTemplates() {
-               return $this->extraIndexBoostTemplates;
-       }
+               $extraIndexBoostTemplates = [];
+               foreach ( $this->getExtraIndices() as $extraIndex ) {
+                       $extraIndexBoosts = $this->config->getElement( 
'CirrusSearchExtraIndexBoostTemplates', $extraIndex );
+                       if ( isset( $extraIndexBoosts['wiki'], 
$extraIndexBoosts['boosts'] ) ) {
+                               
$extraIndexBoostTemplates[$extraIndexBoosts['wiki']] = 
$extraIndexBoosts['boosts'];
+                       }
+               }
 
-       /**
-        * @param string $wiki Index to boost templates within
-        * @param float[] $extraIndexBoostTemplates Map from template name to 
weight to apply to that template
-        */
-       public function addExtraIndexBoostTemplates( $wiki, array 
$extraIndexBoostTemplates ) {
-               $this->isDirty = true;
-               $this->extraIndexBoostTemplates[$wiki] = 
$extraIndexBoostTemplates;
+               return $extraIndexBoostTemplates;
        }
 
        /**
diff --git a/includes/Searcher.php b/includes/Searcher.php
index 29a29db..9292b97 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -512,15 +512,6 @@
                                        [ 'local_sites_with_dupe' => 
$this->indexBaseName ]
                                ) );
                        }
-                       foreach ( $extraIndexes as $extraIndex ) {
-                               $extraIndexBoosts = $this->config->getElement( 
'CirrusSearchExtraIndexBoostTemplates', $extraIndex );
-                               if ( isset( $extraIndexBoosts['wiki'], 
$extraIndexBoosts['boosts'] ) ) {
-                                       
$this->searchContext->addExtraIndexBoostTemplates(
-                                               $extraIndexBoosts['wiki'],
-                                               $extraIndexBoosts['boosts']
-                                       );
-                               }
-                       }
                }
 
                $this->installBoosts();

-- 
To view, visit https://gerrit.wikimedia.org/r/386028
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dc9aeddb785b66dfa2007ba740ca82aea4e61bd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse <dcau...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to