Will be used by Cirrus.
Change-Id: I60e6b19d3b59ebf9bb45cc61d16936dfc7e4c708
return null;
}
+ /**
+ * @return string Highlighted relevant category name or '' if none or not supported
+ */
+ public function getCategorySnippet() {
+ return '';
+ }
+
/**
* @return string Timestamp
*/
$redirectText = $result->getRedirectSnippet();
$sectionTitle = $result->getSectionTitle();
$sectionText = $result->getSectionSnippet();
- $redirect = '';
+ $categorySnippet = $result->getCategorySnippet();
+ $redirect = '';
if ( !is_null( $redirectTitle ) ) {
if ( $redirectText == '' ) {
$redirectText = null;
}
$section = '';
-
if ( !is_null( $sectionTitle ) ) {
if ( $sectionText == '' ) {
$sectionText = null;
"</span>";
}
+ $category = '';
+ if ( $categorySnippet ) {
+ $category = "<span class='searchalttitle'>" .
+ $this->msg( 'search-category' )->rawParams( $categorySnippet )->text() .
+ "</span>";
+ }
+
// format text extract
$extract = "<div class='searchresult'>" . $result->getTextSnippet( $terms ) . "</div>";
$thumb->toHtml( array( 'desc-link' => true ) ) .
'</td>' .
'<td style="vertical-align: top;">' .
- "{$link} {$redirect} {$section} {$fileMatch}" .
+ "{$link} {$redirect} {$category} {$section} {$fileMatch}" .
$extract .
"<div class='mw-search-result-data'>{$desc} - {$date}</div>" .
'</td>' .
&$html
) ) ) {
$html = "<li><div class='mw-search-result-heading'>" .
- "{$link} {$redirect} {$section} {$fileMatch}</div> {$extract}\n" .
+ "{$link} {$redirect} {$category} {$section} {$fileMatch}</div> {$extract}\n" .
"<div class='mw-search-result-data'>{$size} - {$date}</div>" .
"</li>\n";
}
"search-result-category-size": "{{PLURAL:$1|1 member|$1 members}} ({{PLURAL:$2|1 subcategory|$2 subcategories}}, {{PLURAL:$3|1 file|$3 files}})",
"search-redirect": "(redirect $1)",
"search-section": "(section $1)",
+ "search-category": "(category $1)",
"search-file-match": "(matches file content)",
"search-suggest": "Did you mean: $1",
"search-interwiki-caption": "Sister projects",
"search-result-category-size": "Parameters:\n* $1 - number of members in this category. $1 is equal to $2+$3.\n* $2 - number of subcategories\n* $3 - number of files",
"search-redirect": "\"Redirect\" is a noun here, not a verb.\n\nParameters:\n* $1 - a link to the redirect to the page (so, $1 is the page that the search result is redirected '''from''')",
"search-section": "This text will be shown on the search result listing after the page title of a result if the search algorithm thinks that section is more relevant than the rest of the page. $1 is a section title.\n{{Identical|Section}}",
+ "search-category": "This text will be shown on the search result listing after the page title of a result if the search algorithm thinks that the page being in a particular category is relevant. $1 is the category's name with any matching portion highlighted.\n",
"search-file-match": "This text will be shown on the search result listing after the page title of a result if the search engine got search results from the contents of files, rather than the pages.",
"search-suggest": "Used for \"Did you mean\" suggestions:\n* $1 - suggested link",
"search-interwiki-caption": "Used in [[Special:Search]], when showing search results from other wikis.",