jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/338029 )
Change subject: Update norms and index mapping for es5
......................................................................
Update norms and index mapping for es5
ES5 still supports old style mapping, but we should update so the
deprecation logger doesn't complain too loudly.
* norms: convert [enabled: bool] to a simple boolean
* index: convert string value 'no' to simple boolean
Change-Id: I0ab2889055912f21a237541e91f8213629072e7c
---
M includes/Search/CirrusIndexField.php
M includes/Search/KeywordIndexField.php
M includes/Search/ShortTextIndexField.php
M includes/Search/SourceTextIndexField.php
M includes/Search/TextIndexField.php
M tests/unit/Search/SearchFieldsTest.php
6 files changed, 10 insertions(+), 10 deletions(-)
Approvals:
jenkins-bot: Verified
DCausse: Looks good to me, approved
diff --git a/includes/Search/CirrusIndexField.php
b/includes/Search/CirrusIndexField.php
index 49a82e7..67467ae 100644
--- a/includes/Search/CirrusIndexField.php
+++ b/includes/Search/CirrusIndexField.php
@@ -65,7 +65,7 @@
'type' => $this->typeName,
];
if ( $this->checkFlag( SearchIndexField::FLAG_NO_INDEX ) ) {
- $config['index'] = 'no';
+ $config['index'] = false;
}
return $config;
}
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..bb14feb 100644
--- a/includes/Search/SourceTextIndexField.php
+++ b/includes/Search/SourceTextIndexField.php
@@ -35,12 +35,12 @@
$this->initFlags();
$field = [
- 'index' => 'no', // We only use the .plain field
+ 'index' => false, // We only use the .plain field
'type' => 'text',
'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 );
}
diff --git a/tests/unit/Search/SearchFieldsTest.php
b/tests/unit/Search/SearchFieldsTest.php
index 0ab6ef1..bf9cdb2 100644
--- a/tests/unit/Search/SearchFieldsTest.php
+++ b/tests/unit/Search/SearchFieldsTest.php
@@ -36,7 +36,7 @@
$field->setFlag( SearchIndexField::FLAG_NO_INDEX );
$mapping = $field->getMapping( $engine );
- $this->assertEquals( 'no', $mapping['index'] );
+ $this->assertEquals( false, $mapping['index'] );
}
public function testBadField() {
--
To view, visit https://gerrit.wikimedia.org/r/338029
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0ab2889055912f21a237541e91f8213629072e7c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: es5
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits