3 # Rebuild the fulltext search indexes. This may take a while
4 # depending on the database size and server configuration.
6 # Rebuilding is faster if you drop the index and recreate it,
7 # but that will prevent searches from working while it runs.
9 function dropTextIndex()
11 echo "Dropping index...\n";
12 $sql = "ALTER TABLE searchindex DROP INDEX si_title, DROP INDEX si_text";
16 function createTextIndex()
18 echo "Rebuild the index...\n";
19 $sql = "ALTER TABLE searchindex ADD FULLTEXT si_title (si_title), " .
20 "ADD FULLTEXT si_text (si_text)";
24 function rebuildTextIndex()
26 $sql = "SELECT COUNT(*) AS count FROM cur";
28 $s = wfFetchObject($res);
29 echo "Rebuilding index fields for {$s->count} pages...\n";
32 $sql = "SELECT cur_id, cur_namespace, cur_title, cur_text FROM cur";
35 while( $s = wfFetchObject($res) ) {
36 $u = new SearchUpdate( $s->cur_id, $s->cur_title, $s->cur_text );
38 if ( ( (++$n) % 500) == 0) { echo "$n\n"; }