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

Change subject: Update norms mapping for es5
......................................................................

Update norms mapping for es5

ES5 still supports the old style [enabled: bool], but logs warnings
about it being deprecated. Convert to the new style which is a simple
boolean with no options.

Change-Id: I0ab2889055912f21a237541e91f8213629072e7c
---
M includes/Search/KeywordIndexField.php
M includes/Search/ShortTextIndexField.php
M includes/Search/SourceTextIndexField.php
M includes/Search/TextIndexField.php
4 files changed, 7 insertions(+), 7 deletions(-)


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

diff --git a/includes/Search/KeywordIndexField.php 
b/includes/Search/KeywordIndexField.php
index 5320971..5058fd0 100644
--- a/includes/Search/KeywordIndexField.php
+++ b/includes/Search/KeywordIndexField.php
@@ -23,7 +23,7 @@
                $config['analyzer'] =
                        $this->checkFlag( self::FLAG_CASEFOLD ) ? 
'lowercase_keyword' : 'keyword';
                $config += [
-                       'norms' => [ 'enabled' => false ],
+                       'norms' => false,
                        // Omit the length norm because there is only even one 
token
                        'index_options' => 'docs',
                        // TODO: Re-enable after upgrade to es 5.2 and changing 
type to keyword
diff --git a/includes/Search/ShortTextIndexField.php 
b/includes/Search/ShortTextIndexField.php
index 280f878..68238bf 100644
--- a/includes/Search/ShortTextIndexField.php
+++ b/includes/Search/ShortTextIndexField.php
@@ -16,13 +16,13 @@
                $config['search_analyzer'] = 'short_text_search';
                // NOTE: these fields are not used for scoring yet. We should
                // reevaluate these options to
-               // - norms => [ 'enabled' => true ]
+               // - norms => true
                // if we plan to use such fields for scoring and:
                // - index_options => 'offsets'
                // if we plan to support highlighting
                $config += [
                        // Omit the length norm because we use it only for 
filtering
-                       'norms' => [ 'enabled' => false ],
+                       'norms' => false,
                        // Store positions because by using aggressive_splitting
                        // we need to allow precise position matching with 
phrases
                        'index_options' => 'positions',
diff --git a/includes/Search/SourceTextIndexField.php 
b/includes/Search/SourceTextIndexField.php
index 91227d0..c25ae21 100644
--- a/includes/Search/SourceTextIndexField.php
+++ b/includes/Search/SourceTextIndexField.php
@@ -40,7 +40,7 @@
                        'fields' => [
                                'plain' => [
                                        'type' => 'text',
-                                       'norms' => ['enabled' => false],
+                                       'norms' => false,
                                        'analyzer' => 'source_text_plain',
                                        'search_analyzer' => 
'source_text_plain_search',
                                        'position_increment_gap' => 
self::POSITION_INCREMENT_GAP,
@@ -51,7 +51,7 @@
 
                if ( $this->withTrigrams ) {
                        $field['fields']['trigram'] = [
-                               'norms' => ['enabled' => false],
+                               'norms' => false,
                                'type' => 'text',
                                'analyzer' => 'trigram',
                                'index_options' => 'docs',
diff --git a/includes/Search/TextIndexField.php 
b/includes/Search/TextIndexField.php
index 1c8f5ca..90ed634 100644
--- a/includes/Search/TextIndexField.php
+++ b/includes/Search/TextIndexField.php
@@ -123,7 +123,7 @@
                if ( $this->checkFlag( SearchIndexField::FLAG_CASEFOLD ) ) {
                        $extra[] = [
                                'analyzer' => 'lowercase_keyword',
-                               'norms' => [ 'enabled' => false ],
+                               'norms' => false,
                                'index_options' => 'docs',
                                // TODO: Re-enable in ES 5.2 with keyword type 
and s/analyzer/normalizer/
                                //'ignore_above' => 
KeywordIndexField::KEYWORD_IGNORE_ABOVE,
@@ -148,7 +148,7 @@
                ];
                $disableNorms = !$this->checkFlag( self::ENABLE_NORMS );
                if ( $disableNorms ) {
-                       $disableNorms = [ 'norms' => [ 'enabled' => false ] ];
+                       $disableNorms = [ 'norms' => false ];
                        $field = array_merge( $field, $disableNorms );
                        $field[ 'fields' ][ 'plain' ] = array_merge( $field[ 
'fields' ][ 'plain' ], $disableNorms );
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ab2889055912f21a237541e91f8213629072e7c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: es5
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

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

Reply via email to