(bug 22647) Add category details in search results. Contributed by Lejonel.
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Tue, 20 Apr 2010 23:06:59 +0000 (23:06 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Tue, 20 Apr 2010 23:06:59 +0000 (23:06 +0000)
CREDITS
RELEASE-NOTES
includes/specials/SpecialSearch.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

diff --git a/CREDITS b/CREDITS
index 1d0b409..c364add 100644 (file)
--- 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
index 7e5142e..6803516 100644 (file)
@@ -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
index 06d74f2..2ec838c 100644 (file)
@@ -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
index 5a277a4..5c8b485 100644 (file)
@@ -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)',
index 7769794..4852840 100644 (file)
@@ -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',