From: Erik Bernhardson Date: Thu, 30 Apr 2015 23:59:49 +0000 (-0700) Subject: Make api nearmatch search work same as 'go' feature X-Git-Tag: 1.31.0-rc.0~11491^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=2a4675a17f8ae9bc50c948987d26aa655b509bde;p=lhc%2Fweb%2Fwiklou.git Make api nearmatch search work same as 'go' feature The 'nearmatch' feature of the api is the same as the 'go' feature of on-wiki search. This makes the nearmatch api feature return the same results as the user would have gotten in 'go', bringing more parity between api and browser based searching. Without this change asking for a nearmatch within a namespace fails. Bug: T37719 Change-Id: I715326242b63c558572ce9bf69b70bd650c2bc95 --- diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index c12630ed80..90af15a4cd 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -92,7 +92,9 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } elseif ( $what == 'title' ) { $matches = $search->searchTitle( $query ); } elseif ( $what == 'nearmatch' ) { - $matches = SearchEngine::getNearMatchResultSet( $query ); + // near matches must receive the user input as provided, otherwise + // the near matches within namespaces are lost. + $matches = SearchEngine::getNearMatchResultSet( $params['search'] ); } else { // We default to title searches; this is a terrible legacy // of the way we initially set up the MySQL fulltext-based