rebuildtextindex.php doesnt remove wrong data in the searchindex table
Closed, ResolvedPublic

Description

When you have invalid data in the searchindex table, the maintenance script rebuildtextindex.php is there to fix that. However, this currently does not work:

The script currently does only update the _SQL index_, not the _rows_ of the searchindex table. So rows, which should not be there (e.g. as they point to a deleted page), will _stay_(!) in the index. That way the index is created based on wrong data.

rebuildtextindex.php should first rebuild the _actual table data_, before it recreates the SQL index (based on that data).


Version: 1.22.3
Severity: normal

Details

Reference
bz62276
bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz62276.
bzimport added a subscriber: Unknown Object (MLST).
Joergi123 created this task.Mar 5 2014, 9:37 PM

rebuildtextindex.php works correctly when you truncate the searchindex table before you run rebuildtextindex.php. Adding this step to rebuildtextindex.php should solve the issue.

Thanks for taking the time to report this!

In case you are interested to provide a patch, see https://www.mediawiki.org/wiki/Developer_access

Joergi123 added a comment.EditedJan 25 2015, 1:46 PM

If you could do that, it would be amazing!

Your patch adds

$this->clearSearchIndex();

to the "mysql" condition of function execute() of maintenance/rebuildtextindex.php.

This solves the issue for me!

Addshore claimed this task.Jan 27 2015, 6:18 PM
Addshore set Security to None.
gerritbot added a subscriber: gerritbot.

Change 186973 had a related patch set uploaded (by Addshore):
Run clearSearchIndex when mysql in rebuildTextIndex

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

Patch-For-Review

Change 186973 merged by jenkins-bot:
Run clearSearchIndex when mysql in rebuildTextIndex

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

hoo closed this task as Resolved.Jan 27 2015, 9:59 PM
hoo added a subscriber: hoo.
Joergi123 added a subscriber: Joergi123.EditedFeb 7 2015, 2:28 AM

Thanks a bunch, guys!

Can this bugfix still be backported to the supported branches? 1.24 and especially the 1.23 LTS branch will still be around for some time.

Current LTS is 1.23. 1.24 is not LTS but will be supported until November 2015

@MarkAHershberger may decide. It should apply cleanly to those branches.

Thanks for pointing this out; it is not much of an effort and it would solve the bug.

Aklapper added a subscriber: greg.Feb 9 2015, 11:49 AM

CC'ing @greg as this is a backport request for tarballs. (Wondering whether a dedicated "backport request" ticket against the MediaWiki-Tarball-Backports project would not be better, in theory. Whatever workflow works.)