Page MenuHomePhabricator

Search engine fails in Special:IndexPage
Closed, ResolvedPublicBUG REPORT


In Special:IndexPages calls to MediaWiki SearchEngine fails because they do not return SearchResultSet.

Example to reproduce:

Reported first in frwikisource:

Event Timeline

Tpt triaged this task as High priority.EditedNov 6 2019, 1:21 PM
Tpt added a project: All-and-every-Wikisource.
Tpt changed the subtype of this task from "Task" to "Bug Report".

Priority: High for Wikisource (breaks a special page)

@EBernhardson This bug seems to be related to the change in MediaWiki search PHP API. May someone from your team investigate it?

Hey @Tpt, does this help?

reedy@mwdebug1002:~$ mwscript eval.php enwikisource
> $indexNamespaceId = ProofreadPage::getIndexNamespaceId();

> $searchEngine = MediaWiki\MediaWikiServices::getInstance()->getSearchEngineFactory()->create();

> $searchEngine->setLimitOffset( 10, 0 );

> $searchEngine->setNamespaces( [ 106 ] );

> $searchEngine->showRedirects = false;

> $status = $searchEngine->searchText( 'foo' );

> var_dump( gettype( $status ) );
string(6) "object"

> var_dump( $status instanceof Status );

> var_dump( $status->isOK() );

> var_dump( gettype( $status->getValue() ) );
string(6) "object"

> var_dump( $status->getValue() instanceof SearchResultSet  );

> var_dump( get_class( $status->getValue() ) );
string(125) "class@anonymous/srv/mediawiki/php-1.35.0-wmf.5/extensions/CirrusSearch/includes/Search/FullTextResultsType.php0x7fd58bb52d4d"

$status->getValue() is returning the anonymous class (which subclasses BaseCirrusSearchResultSet) at

Which is making a soft dependancy on the CirrusSearch extension...

This shouldn't be checking SearchResultSet, but rather ISearchResultSet. Cirrus's returned object now extends from BaseSearchResultSet in core that implements ISearchResultSet.

Change 550556 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/extensions/ProofreadPage@master] Do not use instanceof SearchResultSet

Change 550556 merged by jenkins-bot:
[mediawiki/extensions/ProofreadPage@master] Do not use instanceof SearchResultSet

DannyS712 added a subscriber: DannyS712.

[batch] remove patch for review tag from resolved tasks