X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchEngine.php;h=90bfebd21319bb753314d7cd5bf6bfc879c6a8b6;hb=17b3bab4d636df56e4a4b55e52fcda9fde892804;hp=fb9b8a351c24833c4b0a731d7f4382e3e7f404fc;hpb=22fbd5a93e491bdcd740900751df2aabeb5c24e0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index fb9b8a351c..90bfebd213 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -547,13 +547,20 @@ abstract class SearchEngine { return $sugg->getSuggestedTitle()->getPrefixedText(); } ); - // 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 ); + if ( $this->offset === 0 ) { + // 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 ); + } else { + // No need to rescore if offset is not 0 + // The exact match must have been returned at position 0 + // if it existed. + $rescoredResults = $results; + } if ( count( $rescoredResults ) > 0 ) { $found = array_search( $rescoredResults[0], $results ); @@ -672,10 +679,11 @@ abstract class SearchEngine { * - default: set to true if this profile is the default * * @since 1.28 - * @param $profileType the type of profiles + * @param string $profileType the type of profiles + * @param User|null $user the user requesting the list of profiles * @return array|null the list of profiles or null if none available */ - public function getProfiles( $profileType ) { + public function getProfiles( $profileType, User $user = null ) { return null; }