Page MenuHomePhabricator

API: list=search&srwhat=nearmatch doesn't work for titles with namespace prefix
Closed, ResolvedPublic

Description

If LuceneSearch is enabled (like on Wikipedia), list=search&srwhat=nearmatch doesn't work for any titles outside main namespace (see url).

This is due to ApiQuerySearch calling $search->replacePrefixes on the search term, which is incorrect for "nearmatch" mode. LuceneSearch replaces the namespace prefixes to an internal format, so "Wikipedia:About" is transformed to "[4]:About", so the title can't be found anymore.


Version: unspecified
Severity: normal
URL: http://en.wikipedia.org/w/api.php?action=query&list=search&srwhat=nearmatch&srsearch=Wikipedia:About

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:11 AM
bzimport added a project: MediaWiki-API.
bzimport set Reference to bz35719.
bzimport added a subscriber: Unknown Object (MLST).
P.Copp created this task.Apr 5 2012, 11:12 AM
Anomie added a subscriber: Anomie.Feb 20 2015, 3:27 PM

Going by the code in SpecialSearch, 'nearmatch' mode probably shouldn't be calling $search->transformSearchTerm() either.

Anomie set Security to None.
Anomie moved this task from Unsorted to Needs Code on the MediaWiki-API board.

Change 208039 had a related patch set uploaded (by Anomie):
Make api nearmatch search work same as 'go' feature

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

Anomie moved this task from Needs Code to Needs Review on the MediaWiki-API board.May 1 2015, 5:12 PM

Change 208039 merged by jenkins-bot:
Make api nearmatch search work same as 'go' feature

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

Anomie closed this task as Resolved.May 5 2015, 9:04 PM
Anomie assigned this task to EBernhardson.