Split sql fulltext index creation into two statements
authorErik Bernhardson <ebernhardson@wikimedia.org>
Tue, 10 Oct 2017 16:51:39 +0000 (09:51 -0700)
committerMaxSem <maxsem.wiki@gmail.com>
Fri, 13 Oct 2017 18:51:02 +0000 (18:51 +0000)
MySQL prior to 5.6.8 (https://bugs.mysql.com/bug.php?id=67004) did
not support adding multiple fulltext indices at the same time on InnoDB.
Split them into two statements to work around this limitation.

Bug: T177477
Change-Id: Ib366fa04724abac6d740bea017274ad62730b9e5

maintenance/rebuildtextindex.php

index faa4d96..c786925 100644 (file)
@@ -145,9 +145,10 @@ class RebuildTextIndex extends Maintenance {
        private function createMysqlTextIndex() {
                $searchindex = $this->db->tableName( 'searchindex' );
                $this->output( "\nRebuild the index...\n" );
-               $sql = "ALTER TABLE $searchindex ADD FULLTEXT si_title (si_title), " .
-                       "ADD FULLTEXT si_text (si_text)";
-               $this->db->query( $sql, __METHOD__ );
+               foreach ( [ 'si_title', 'si_text' ] as $field ) {
+                       $sql = "ALTER TABLE $searchindex ADD FULLTEXT $field ($field)";
+                       $this->db->query( $sql, __METHOD__ );
+               }
        }
 
        /**