Page MenuHomePhabricator

Error searching Lexeme:Danke on Wikidata: "Call to a member function setFragment() on null"
Closed, ResolvedPublic

Description

When I search for Lexeme:Danke from the Search box in Wikidata (upper right corner) I get the message

[XYqWIwpAADoAAJk2AOEAAABL] 2019-09-24 22:18:11: Fatal exception of type "Error"

The time and the code in the beginning change from request to request.

exception.file 	/srv/mediawiki/php-1.34.0-wmf.23/extensions/WikibaseLexemeCirrusSearch/src/LexemeResult.php:57
exception.message	Call to a member function setFragment() on null
exception.trace
#0 /srv/mediawiki/php-1.34.0-wmf.23/extensions/WikibaseLexemeCirrusSearch/src/LexemeResultSet.php(72): Wikibase\Lexeme\Search\Elastic\LexemeResult->__construct(LanguageEn, Wikibase\Lexeme\DataAccess\LexemeDescription, array)
#1 /srv/mediawiki/php-1.34.0-wmf.23/extensions/CirrusSearch/includes/Search/BaseCirrusSearchResultSet.php(162): Wikibase\Lexeme\Search\Elastic\LexemeResultSet->transformOneResult(Elastica\Result)
#2 /srv/mediawiki/php-1.34.0-wmf.23/includes/search/SearchResultSetTrait.php(58): CirrusSearch\Search\BaseCirrusSearchResultSet->extractResults()
#3 /srv/mediawiki/php-1.34.0-wmf.23/extensions/CirrusSearch/includes/RequestLogger.php(374): CirrusSearch\Search\BaseCirrusSearchResultSet->getIterator()
#4 /srv/mediawiki/php-1.34.0-wmf.23/extensions/CirrusSearch/includes/RequestLogger.php(181): CirrusSearch\RequestLogger->extractTitleStrings(Wikibase\Lexeme\Search\Elastic\LexemeResultSet)
#5 /srv/mediawiki/php-1.34.0-wmf.23/extensions/CirrusSearch/includes/ElasticsearchIntermediary.php(118): CirrusSearch\RequestLogger->setResultPages(array)
#6 /srv/mediawiki/php-1.34.0-wmf.23/extensions/CirrusSearch/includes/CirrusSearch.php(205): CirrusSearch\ElasticsearchIntermediary::setResultPages(array)
#7 /srv/mediawiki/php-1.34.0-wmf.23/includes/search/SearchEngine.php(86): CirrusSearch\CirrusSearch->doSearchText(string)
#8 /srv/mediawiki/php-1.34.0-wmf.23/includes/search/SearchEngine.php(172): SearchEngine->{closure}()
#9 /srv/mediawiki/php-1.34.0-wmf.23/includes/search/SearchEngine.php(87): SearchEngine->maybePaginate(Closure)
#10 /srv/mediawiki/php-1.34.0-wmf.23/includes/specials/SpecialSearch.php(356): SearchEngine->searchText(string)
#11 /srv/mediawiki/php-1.34.0-wmf.23/includes/specials/SpecialSearch.php(179): SpecialSearch->showResults(string)
#12 /srv/mediawiki/php-1.34.0-wmf.23/includes/specialpage/SpecialPage.php(575): SpecialSearch->execute(NULL)
#13 /srv/mediawiki/php-1.34.0-wmf.23/includes/specialpage/SpecialPageFactory.php(611): SpecialPage->run(NULL)
#14 /srv/mediawiki/php-1.34.0-wmf.23/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#15 /srv/mediawiki/php-1.34.0-wmf.23/includes/MediaWiki.php(892): MediaWiki->performRequest()
#16 /srv/mediawiki/php-1.34.0-wmf.23/includes/MediaWiki.php(523): MediaWiki->main()
#17 /srv/mediawiki/php-1.34.0-wmf.23/index.php(44): MediaWiki->run()
#18 /srv/mediawiki/w/index.php(3): require(string)
#19 {main}

Event Timeline

Oh, wow, it also happens for Lexeme:thanks

I am super curious what is happening here!

Searching for other things (e.g. "L:hat" or "Lexeme:hat" seems to work fine.

If you go to the search page and select "Lexeme" as the only namespace you get the same error with "thanks" in the search box, but "thank" alone works fine - the two lexemes that match are L3798 (verb) and L28468 (noun).

Aklapper renamed this task from Searching Lexeme:Danke on Wikidata breaks it to Error searching Lexeme:Danke on Wikidata: "Call to a member function setFragment() on null".Sep 27 2019, 2:04 PM
Aklapper updated the task description. (Show Details)

Curiously, PHPUnit is failing on the WikibaseLexemeCirrusSearch repo with "Call to a member function setFragment() on null". I don't know if it's exactly the same error, but oh well...

AFAICS, mTitle is not defined as property, and this happens as of https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/CirrusSearch/+/531450/

IMHO, it's pretty sad that:

  • This wasn't spotted when updating the class;
  • Nothing triggered (PHPUnit) tests in WBLCS in the last month, and hence the error remained unnoticed;
  • Phan wouldn't have caught it anyway, because we use stubs.

That's a failure across the board... I'm going to fix the code itself, and make phan more powerful. And, as a side note, it'd be great to automatically run tests in a repo when no changes were sent in say the last month.

AFAICS, mTitle is not defined as property, and this happens as of https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/CirrusSearch/+/531450/

Uh, actually, not completely culprit. I was deceived by my IDE which still had to load the RevisionSearchResultTrait. Which does have an mTitle property; however, although it's documented as Title only, it can also be null.

Change 541223 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/core@master] searchResult: Fix docs for mTitle

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

Change 541225 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/WikibaseLexemeCirrusSearch@master] LexemeResult: guard against mTitle being null

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

Change 541223 merged by jenkins-bot:
[mediawiki/core@master] searchResult: Fix docs for mTitle

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

Change 541225 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexemeCirrusSearch@master] LexemeResult: guard against mTitle being null

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

Daimona removed a project: Patch-For-Review.