Manybubbles has uploaded a new change for review.

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


Change subject: Don't write to _all field.
......................................................................

Don't write to _all field.

This cuts the index size by about 10% which should cut memory usage
similarly.

Change-Id: I16240b0900619107e271180406c49055d8124513
---
M includes/CirrusSearchMappingConfigBuilder.php
M maintenance/updateOneSearchIndexConfig.php
2 files changed, 35 insertions(+), 13 deletions(-)


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

diff --git a/includes/CirrusSearchMappingConfigBuilder.php 
b/includes/CirrusSearchMappingConfigBuilder.php
index 56ea47a..69146b6 100644
--- a/includes/CirrusSearchMappingConfigBuilder.php
+++ b/includes/CirrusSearchMappingConfigBuilder.php
@@ -48,26 +48,26 @@
 
                return array(
                        'properties' => array(
+                               'timestamp' => array(
+                                       'type' => 'date',
+                                       'format' => 'dateOptionalTime',
+                                       'include_in_all' => false,
+                               ),
+                               'namespace' => $this->buildLongField(),
                                'title' => $this->buildStringField( 'title', 
$titleExtraAnalyzers ),
                                'text' => $this->buildStringField( 'text', 
$textExtraAnalyzers ),
                                'category' => 
$this->buildLowercaseKeywordField(),
                                'heading' => $this->buildStringField( 'heading' 
),
-                               'text_bytes' => array( 'type' => 'long', 
'store' => 'yes' ),
-                               'text_words' => array( 'type' => 'long', 
'store' => 'yes' ),
+                               'text_bytes' => $this->buildLongField(),
+                               'text_words' => $this->buildLongField(),
                                'redirect' => array(
                                        'properties' => array(
-                                               'namespace' =>  array( 'type' 
=> 'long', 'store' => 'yes' ),
+                                               'namespace' =>  
$this->buildLongField(),
                                                'title' => 
$this->buildStringField( 'title', array( 'suggest' ) ),
                                        )
                                ),
-                               'links' => array(
-                                       'type' => 'integer',
-                                       'store' => 'yes',
-                               ),
-                               'redirect_links' => array(
-                                       'type' => 'integer',
-                                       'store' => 'yes',
-                               )
+                               'links' => $this->buildLongField(),
+                               'redirect_links' => $this->buildLongField(),
                        ),
                );
        }
@@ -87,16 +87,22 @@
                                        'analyzer' => 'text',
                                        'store' => 'yes',
                                        'term_vector' => 
'with_positions_offsets',
+                                       'include_in_all' => false,
                                ),
                                'plain' => array(
                                        'type' => 'string',
                                        'analyzer' => 'plain',
                                        'term_vector' => 
'with_positions_offsets',
+                                       'include_in_all' => false,
                                ),
                        )
                );
                foreach ( $extra as $extraname ) {
-                       $field[ 'fields' ][ $extraname ] = array( 'type' => 
'string', 'analyzer' => $extraname );
+                       $field[ 'fields' ][ $extraname ] = array(
+                               'type' => 'string',
+                               'analyzer' => $extraname,
+                               'include_in_all' => false,
+                       );
                }
                return $field;
        }
@@ -106,7 +112,22 @@
         * @return array definition of the field
         */
        private function buildLowercaseKeywordField() {
-               return array( 'type' => 'string', 'analyzer' => 
'lowercase_keyword' );
+               return array(
+                       'type' => 'string',
+                       'analyzer' => 'lowercase_keyword',
+                       'include_in_all' => false,
+               );
        }
 
+       /**
+        * Create a long field.
+        * @return array definition of the field
+        */
+       private function buildLongField() {
+               return array(
+                       'type' => 'long',
+                       'store' => 'yes',
+                       'include_in_all' => false,
+               );
+       }
 }
diff --git a/maintenance/updateOneSearchIndexConfig.php 
b/maintenance/updateOneSearchIndexConfig.php
index a7f0625..ab90e8a 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -590,6 +590,7 @@
                                'number_of_replicas' => 
$this->reindexAndRemoveOk ? 0 : $this->getReplicaCount(),
                                'analysis' => 
CirrusSearchAnalysisConfigBuilder::build(),
                                'translog.flush_threshold_ops' => 50000,   // 
This is supposed to help with bulk index io load.
+                               'index.query.default_field' => 'page.text', // 
Since the _all field is disabled, we should query something.
                        )
                ), $rebuild );
                $this->closeOk = false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I16240b0900619107e271180406c49055d8124513
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