From 2a4675a17f8ae9bc50c948987d26aa655b509bde Mon Sep 17 00:00:00 2001 From: Erik Bernhardson Date: Thu, 30 Apr 2015 16:59:49 -0700 Subject: [PATCH] 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 --- includes/api/ApiQuerySearch.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.20.1