Manybubbles has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/115215

Change subject: 1.0 updates
......................................................................

1.0 updates

These changes get us working "better" with elasticsearch's master branch
but really are only a starting point for fixing us for 1.0.  Or something.

Change-Id: I1dc24be8350b3a9d7ec9aa4fc251368c7c4b7da2
---
M maintenance/updateOneSearchIndexConfig.php
1 file changed, 10 insertions(+), 6 deletions(-)


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

diff --git a/maintenance/updateOneSearchIndexConfig.php 
b/maintenance/updateOneSearchIndexConfig.php
index 0d34258..8a4a353 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -232,7 +232,7 @@
                $this->output( $this->indent . "\tValidating number of 
shards..." );
                $settingsObject = $this->getIndex()->getSettings();
                $settings = $settingsObject->get();
-               $actualShardCount = $settings[ 'index.number_of_shards' ];
+               $actualShardCount = $settings[ 'index' ][ 'number_of_shards' ];
                if ( $actualShardCount == $this->getShardCount() ) {
                        $this->output( "ok\n" );
                } else {
@@ -245,7 +245,7 @@
                }
 
                $this->output( $this->indent . "\tValidating number of 
replicas..." );
-               $actualReplicaCount = $settings[ 'index.number_of_replicas' ];
+               $actualReplicaCount = $settings[ 'index' ][ 
'number_of_replicas' ];
                if ( $actualReplicaCount == $this->getReplicaCount() ) {
                        $this->output( "ok\n" );
                } else {
@@ -261,7 +261,7 @@
                $settings = $settingsObject->get();
                $analysisConfig = new AnalysisConfigBuilder( $this->langCode, 
$this->aggressiveSplitting );
                $requiredAnalyzers = $analysisConfig->buildConfig();
-               if ( $this->vaActualMatchRequired( 'index.analysis', $settings, 
$requiredAnalyzers ) ) {
+               if ( $this->vmActualMatchRequired( $settings[ 'index' ][ 
'analysis' ], $requiredAnalyzers ) ) {
                        $this->output( "ok\n" );
                } else {
                        $this->output( "different..." );
@@ -290,6 +290,7 @@
        private function vaActualMatchRequired( $prefix, $settings, $required ) 
{
                foreach( $required as $key => $value ) {
                        $settingsKey = $prefix . '.' . $key;
+
                        if ( is_array( $value ) ) {
                                if ( !$this->vaActualMatchRequired( 
$settingsKey, $settings, $value ) ) {
                                        return false;
@@ -341,11 +342,15 @@
         */
        private function vmActualMatchRequired( $actual, $required ) {
                foreach( $required as $key => $value ) {
+                       // print "$key...";
                        if ( !array_key_exists( $key, $actual ) ) {
+                               // print "not found\n";
                                return false;
                        }
                        if ( is_array( $value ) ) {
+                               // print "descend...";
                                if ( !is_array( $actual[ $key ] ) ) {
+                                       // print "other not array\n";
                                        return false;
                                }
                                if ( !$this->vmActualMatchRequired( $actual[ 
$key ], $value ) ) {
@@ -354,10 +359,9 @@
                                continue;
                        }
 
-                       if ( $actual[ $key ] === 'false' ) {
-                               $actual[ $key ] = false;
-                       }
+                       // print "value...";
                        // Note that I really mean !=, not !==.  Coercion is 
cool here.
+                       // print $actual[ $key ] . "  $value\n";
                        if ( $actual[ $key ] != $value ) {
                                return false;
                        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1dc24be8350b3a9d7ec9aa4fc251368c7c4b7da2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to