X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSqlSearchResultSet.php;h=f5d795f4b604d38bbddbadb481b54a42baf7bdbd;hb=a89f844919271da2e7c4d2a540de6d0f516d845a;hp=f4e4a23abec061c1a09d521840c40316d8881c29;hpb=13d95407dc11293a3a238f66a40db89e502c64b7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SqlSearchResultSet.php b/includes/search/SqlSearchResultSet.php index f4e4a23abe..f5d795f4b6 100644 --- a/includes/search/SqlSearchResultSet.php +++ b/includes/search/SqlSearchResultSet.php @@ -16,12 +16,22 @@ class SqlSearchResultSet extends SearchResultSet { /** @var int|null Total number of hits for $terms */ protected $totalHits; - function __construct( IResultWrapper $resultSet, $terms, $total = null ) { + /** + * @param IResultWrapper $resultSet + * @param string[] $terms + * @param int|null $total + */ + function __construct( IResultWrapper $resultSet, array $terms, $total = null ) { + parent::__construct(); $this->resultSet = $resultSet; $this->terms = $terms; $this->totalHits = $total; } + /** + * @return string[] + * @deprecated since 1.34 + */ function termMatches() { return $this->terms; } @@ -42,23 +52,20 @@ class SqlSearchResultSet extends SearchResultSet { if ( $this->results === null ) { $this->results = []; $this->resultSet->rewind(); + $terms = \MediaWiki\MediaWikiServices::getInstance()->getContentLanguage() + ->convertForSearchResult( $this->terms ); while ( ( $row = $this->resultSet->fetchObject() ) !== false ) { - $this->results[] = SearchResult::newFromTitle( - Title::makeTitle( $row->page_namespace, $row->page_title ), $this + $result = new SqlSearchResult( + Title::makeTitle( $row->page_namespace, $row->page_title ), + $terms ); + $this->augmentResult( $result ); + $this->results[] = $result; } } return $this->results; } - function free() { - if ( $this->resultSet === false ) { - return; - } - - $this->resultSet->free(); - } - function getTotalHits() { if ( !is_null( $this->totalHits ) ) { return $this->totalHits;