From 59b1a5c278d0ae371936f45f7123887f3a674170 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Tue, 20 Apr 2010 23:06:59 +0000 Subject: [PATCH] (bug 22647) Add category details in search results. Contributed by Lejonel. --- CREDITS | 3 ++- RELEASE-NOTES | 1 + includes/specials/SpecialSearch.php | 12 ++++++++++++ languages/messages/MessagesEn.php | 1 + maintenance/language/messages.inc | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index 1d0b4091af..c364add83d 100644 --- a/CREDITS +++ b/CREDITS @@ -89,9 +89,10 @@ following names for their contribution to the product. * Karun Dambietz * Kim Hyun-Joon * Lee Worden +* Lejonel * liangent -* Lucas Garczewski * Louperivois +* Lucas Garczewski * Luigi Corsaro * Manuel Menal * Marcin Cieślak diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7e5142eb74..6803516f1b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -51,6 +51,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 23206) Add Special::Search hook for detecting successful "Go" * When visiting a "red link" of a deleted file, a deletion and move log excerpt is provided on the Upload form. +* (bug 22647) Add category details in search results. === Bug fixes in 1.17 === * (bug 17560) Half-broken deletion moved image files to deletion archive diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 06d74f2566..2ec838ce2a 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -539,6 +539,18 @@ class SpecialSearch { $this->sk->formatSize( $byteSize ), $wgLang->formatNum( $wordCount ) ); + + if( $t->getNamespace() == NS_CATEGORY ) { + $cat = Category::newFromTitle( $t ); + $size = wfMsgExt( + 'search-result-category-size', + array( 'parsemag', 'escape' ), + $wgLang->formatNum( $cat->getPageCount() ), + $wgLang->formatNum( $cat->getSubcatCount() ), + $wgLang->formatNum( $cat->getFileCount() ) + ); + } + $date = $wgLang->timeanddate( $timestamp ); // link to related articles if supported diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 5a277a4c54..5c8b4853b7 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1625,6 +1625,7 @@ Note that using the navigation links will reset this column.', 'searchprofile-everything-tooltip' => 'Search all of content (including talk pages)', 'searchprofile-advanced-tooltip' => 'Search in custom namespaces', 'search-result-size' => '$1 ({{PLURAL:$2|1 word|$2 words}})', +'search-result-category-size' => '{{PLURAL:$1|1 member|$1 members}} ({{PLURAL:$2|1 subcategory|$2 subcategories}}, {{PLURAL:$3|1 file|$3 files}})', 'search-result-score' => 'Relevance: $1%', 'search-redirect' => '(redirect $1)', 'search-section' => '(section $1)', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 7769794a05..485284022e 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -818,6 +818,7 @@ $wgMessageStructure = array( 'searchprofile-everything-tooltip', 'searchprofile-advanced-tooltip', 'search-result-size', + 'search-result-category-size', 'search-result-score', 'search-redirect', 'search-section', -- 2.20.1