r55977 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55976‎ | r55977 | r55978 >
Date:15:27, 7 September 2009
Author:jojo
Status:deferred
Tags:
Comment:
tweak to get suggestions for small articles
Modified paths:
  • /trunk/extensions/Collection/Collection.suggest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.suggest.php
@@ -158,7 +158,6 @@
159159 private static function getCollectionSuggestTemplate( $mode, $param ) {
160160 global $wgCollectionMaxSuggestions;
161161
162 -
163162 switch($mode) {
164163 case 'add':
165164 SpecialCollection::addArticleFromName(NS_MAIN, $param);
@@ -472,6 +471,10 @@
473472 foreach ( $linkcount as $link => $count ) {
474473 $result[$link] = 1 + 0.5*log($count)/$norm;
475474 }
 475+ } else {
 476+ foreach ( $linkcount as $link => $count ) {
 477+ $result[$link] = 1;
 478+ }
476479 }
477480
478481 return $result;
@@ -508,8 +511,12 @@
509512 }
510513 usort( $prop, "wgCollectionCompareProps" );
511514 $this->mPropList = array();
 515+ $have_real_weights = false;
512516 foreach ( $prop as $p ) {
513 - if ( $p['val'] <= 1 ) {
 517+ if ( $p['val'] > 1 ) {
 518+ $have_real_weights = true;
 519+ }
 520+ if ( $p['val'] <= 1 && $have_real_weights ) {
514521 break;
515522 }
516523 $this->mPropList[] = $p;

Status & tagging log