Manybubbles has uploaded a new change for review.
https://gerrit.wikimedia.org/r/168367
Change subject: Only index namespaces when rebuiling general index
......................................................................
Only index namespaces when rebuiling general index
Doing it on every index is a waste of time and will fail on first build
because the general index doesn't yet exist.
Also fix some warnings.
Change-Id: I764377f411b26a966cc1d9f14ec965a17615549b
---
M includes/Maintenance/Maintenance.php
M maintenance/updateOneSearchIndexConfig.php
2 files changed, 11 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/67/168367/1
diff --git a/includes/Maintenance/Maintenance.php
b/includes/Maintenance/Maintenance.php
index 2df7ea5..500a342 100644
--- a/includes/Maintenance/Maintenance.php
+++ b/includes/Maintenance/Maintenance.php
@@ -36,7 +36,6 @@
// Others get one tab beyond the last
Maintenance::$indent = Maintenance::$indent . "\t";
}
- $this->indent = Maintenance::$indent;
}
/**
diff --git a/maintenance/updateOneSearchIndexConfig.php
b/maintenance/updateOneSearchIndexConfig.php
index 9fac3f1..103d863 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -3,6 +3,7 @@
namespace CirrusSearch\Maintenance;
use \CirrusSearch\Connection;
+use \CirrusSearch\ElasticsearchIntermediary;
use Elastica;
use \ProfileSection;
@@ -283,9 +284,12 @@
}
private function indexNamespaces() {
- $child = $this->runChild(
'CirrusSearch\Maintenance\IndexNamespaces' );
- $child->execute();
- $child->done();
+ // Only index namespaces if we're doing the general index
+ if ( $this->indexType === 'general' ) {
+ $child = $this->runChild(
'CirrusSearch\Maintenance\IndexNamespaces' );
+ $child->execute();
+ $child->done();
+ }
}
private function validateIndex() {
@@ -422,7 +426,8 @@
*/
private function checkMapping( $requiredMappings ) {
$actualMappings = $this->getIndex()->getMapping();
- $this->output( "\n" . $this->indent . "\tValidating mapping..."
);
+ $this->output( "\n" );
+ $this->outputIndented( "\tValidating mapping..." );
if ( $this->checkConfig( $actualMappings, $requiredMappings ) )
{
$this->output( "ok\n" );
return true;
@@ -438,9 +443,6 @@
* @return bool
*/
private function checkConfig( $actual, $required, $indent = null ) {
- if ( $indent === null ) {
- $indent = $this->indent . "\t\t";
- }
foreach( $required as $key => $value ) {
$this->debugCheckConfig( "\n$indent$key: " );
if ( !array_key_exists( $key, $actual ) ) {
@@ -558,11 +560,7 @@
if ( $this->reindexAndRemoveOk ) {
$this->output( "is taken...\n" );
$this->outputIndented( "\tReindexing...\n" );
- // Muck with $this->indent because reindex is used to
running at the top level.
- $saveIndent = $this->indent;
- $this->indent = $this->indent . "\t\t";
$this->reindex();
- $this->indent = $saveIndent;
if ( $this->tooFewReplicas ) {
// Optimize the index so it'll be more compact
for replication. Not required
// but should be helpful.
@@ -748,12 +746,12 @@
$filter = null;
$messagePrefix = "";
if ( $childNumber === 1 && $children === 1 ) {
- $this->outputIndented( "Starting single process
reindex\n" );
+ $this->outputIndented( "\t\tStarting single process
reindex\n" );
} else {
if ( $childNumber >= $children ) {
$this->error( "Invalid parameters - childNumber
>= children ($childNumber >= $children) ", 1 );
}
- $messagePrefix = "[$childNumber] ";
+ $messagePrefix = "\t\t[$childNumber] ";
$this->outputIndented( $messagePrefix . "Starting child
process reindex\n" );
// Note that it is not ok to abs(_uid.hashCode) because
hashCode(Integer.MIN_VALUE) == Integer.MIN_VALUE
$filter = new Elastica\Filter\Script( array(
--
To view, visit https://gerrit.wikimedia.org/r/168367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I764377f411b26a966cc1d9f14ec965a17615549b
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