Page MenuHomePhabricator

Api search returns empty page with MWSearch extension when srsearch=title
Closed, ResolvedPublic

Description

Author: Bryan.TongMinh

Description:
Api search returns empty page with MWSearch extension. See http://commons.wikimedia.org/w/api.php?action=query&list=search&srsearch=meaning.


Version: 1.13.x
Severity: major
URL: http://commons.wikimedia.org/w/api.php?action=query&list=search&srsearch=meaning

Details

Reference
bz13482

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:02 PM
bzimport set Reference to bz13482.
bzimport added a subscriber: Unknown Object (MLST).

It appears the bug only applies to searches with the parameter srsearch=title which is the default for this parameter.

Working: http://en.wikipedia.org/w/api.php?action=query&list=search&srwhat=text&srsearch=meaning
Not working: http://en.wikipedia.org/w/api.php?action=query&list=search&srwhat=title&srsearch=meaning

Bumped severity to major.

Bryan.TongMinh wrote:

That clarifies a lot. See this code in the MWSearch extension:

// this stuff's a little broken atm
global $wgLuceneDisableTitleMatches;
if( $wgLuceneDisableTitleMatches ) {
    return null;
} else {
    return LuceneSearchSet::newFromQuery( 'titlematch',
        $term, $this->namespaces, $this->limit, $this->offset );
}

Apparently a search can return null sometimes. The question is what to do when null is returned. Should we raise an error or silently fail and return an empty list?

Bryan.TongMinh wrote:

Fixed in r32349. Will raise a search-text-disabled or search-title-disabled when either search type is disabled.

Note that the split between title and text searching will probably go away entirely soon.