From 4c2f0e39401fdf2d95714fc26198162a4810efb8 Mon Sep 17 00:00:00 2001 From: dcausse Date: Fri, 11 Mar 2016 09:30:34 +0100 Subject: [PATCH] completionSearch: try an exact match even if the backend returns no result Unfortunately some backends (like Cirrus) are not able to do proper crossnamespace lookup. If the backend returns no result we should still try an exact title match. Bug:T129575 Change-Id: Ic08ec0aac0fd8a289f21753d74ae62ba509de841 --- includes/search/SearchEngine.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 1344f4cf38..b263fb39e9 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -708,10 +708,6 @@ class SearchEngine { * @return SearchSuggestionSet */ protected function processCompletionResults( $search, SearchSuggestionSet $suggestions ) { - if ( $suggestions->getSize() == 0 ) { - // If we don't have anything, don't bother - return $suggestions; - } $search = trim( $search ); // preload the titles with LinkBatch $titles = $suggestions->map( function( SearchSuggestion $sugg ) { @@ -726,6 +722,10 @@ class SearchEngine { } ); // Rescore results with an exact title match + // NOTE: in some cases like cross-namespace redirects + // (frequently used as shortcuts e.g. WP:WP on huwiki) some + // backends like Cirrus will return no results. We should still + // try an exact title match to workaround this limitation $rescorer = new SearchExactMatchRescorer(); $rescoredResults = $rescorer->rescore( $search, $this->namespaces, $results, $this->limit ); -- 2.20.1