Page MenuHomePhabricator

Search engine fails in Special:IndexPage
Closed, ResolvedPublicBUG REPORT

Description

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

Example to reproduce: https://en.wikisource.org/wiki/Special:IndexPages?key=+intitle%3AJaures

Reported first in frwikisource: https://fr.wikisource.org/wiki/Wikisource:Scriptorium/Septembre_2019#%22_le_moteur_de_recherche_ne_fonctionne_pas%22

Details

Related Gerrit Patches:
mediawiki/extensions/ProofreadPage : masterDo not use instanceof SearchResultSet

Event Timeline

Tpt created this task.Sep 12 2019, 8:59 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 12 2019, 8:59 AM
Tpt triaged this task as High priority.EditedWed, Nov 6, 1:21 PM
Tpt added a project: 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?

Xover added a subscriber: Xover.Sat, Nov 9, 10:39 AM
Reedy added a comment.EditedSat, Nov 9, 10:05 PM

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 );
bool(true)

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

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

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

> 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 https://github.com/wikimedia/mediawiki-extensions-CirrusSearch/blob/master/includes/Search/FullTextResultsType.php#L79

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

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

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

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

Gehel closed this task as Resolved.Wed, Nov 13, 4:27 PM
DannyS712 added a subscriber: DannyS712.

[batch] remove patch for review tag from resolved tasks