41 if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {
51 if ( !$permissionManager->userCan(
52 'read', $this->specialPage->getUser(), $result->getTitle()
54 return "<li>{$link}</li>";
60 $date = $this->specialPage->getLanguage()->userTimeAndDate(
61 $result->getTimestamp(),
62 $this->specialPage->getUser()
65 $snippet = $result->getTextSnippet();
67 $extract =
"<div class='searchresult'>$snippet</div>";
72 if ( $thumb ===
null ) {
84 $terms = $result instanceof \SqlSearchResult ? $result->getTermMatches() : [];
86 $this->specialPage, $result, $terms,
87 &$link, &$redirect, &$section, &$extract,
88 &$score, &$desc, &$date, &$related, &$html
95 $joined =
"{$link} {$redirect} {$category} {$section} {$file}";
98 if ( $thumb ===
null ) {
100 "<div class='mw-search-result-heading'>{$joined}</div>" .
101 "{$extract} {$meta}";
104 "<table class='searchResultImage'>" .
106 "<td style='width: 120px; text-align: center; vertical-align: top'>" .
109 "<td style='vertical-align: top'>" .
110 "{$joined} {$extract} {$meta}" .
116 return "<li class='mw-search-result'>{$html}</li>";
130 $snippet = $result->getTitleSnippet();
131 if ( $snippet ===
'' ) {
138 $title = clone $result->getTitle();
141 $attributes = [
'data-serp-pos' => $position ];
143 [ &
$title, &$snippet, $result,
147 $link = $this->linkRenderer->makeLink(
170 : $this->linkRenderer->makeLink(
$title, $text ?
new HtmlArmor( $text ) :
null );
172 return "<span class='searchalttitle'>" .
173 $this->specialPage->msg( $msgKey )->rawParams( $inner )->parse()
182 $title = $result->getRedirectTitle();
193 $title = $result->getSectionTitle();
204 $snippet = $result->getCategorySnippet();
215 $title = $result->getTitle();
218 return $this->specialPage->msg(
'search-result-category-size' )
219 ->numParams( $cat->getPageCount(), $cat->getSubcatCount(), $cat->getFileCount() )
222 } elseif ( $result->getByteSize() !==
null || $result->getWordCount() > 0 ) {
223 $lang = $this->specialPage->getLanguage();
224 $bytes =
$lang->formatSize( $result->getByteSize() );
225 $words = $result->getWordCount();
227 return $this->specialPage->msg(
'search-result-size', $bytes )
228 ->numParams( $words )
242 $title = $result->getTitle();
244 return [
'',
null, null ];
247 if ( $result->isFileMatch() ) {
248 $html =
"<span class='searchalttitle'>" .
249 $this->specialPage->msg(
'search-file-match' )->escaped() .
261 $thumb = $img->transform( [
'width' => 120,
'height' => 120 ] );
263 $descHtml = $this->specialPage->msg(
'parentheses' )
264 ->rawParams( $img->getShortDesc() )
266 $thumbHtml = $thumb->toHtml( [
'desc-link' =>
true ] );
270 return [ $html, $descHtml, $thumbHtml ];
281 if ( $desc && $date ) {
282 $meta =
"{$desc} - {$date}";
291 return "<div class='mw-search-result-data'>{$meta}</div>";