Turn $wgSearchRunSuggestedQueryPercent into $wgSearchRunSuggestedQuery
authorMax Semenik <maxsem.wiki@gmail.com>
Fri, 25 Sep 2015 21:01:00 +0000 (14:01 -0700)
committerMax Semenik <maxsem.wiki@gmail.com>
Fri, 25 Sep 2015 21:01:00 +0000 (14:01 -0700)
Deciding how to behave randomly is useful for testing, yet misleading
for general usage. Now that testing is over, make it a boolean switch.

Change-Id: I3e4d02aa57c853c20152c9071c444e09da57fb35

RELEASE-NOTES-1.26
includes/DefaultSettings.php
includes/specials/SpecialSearch.php

index a13fc2e..aab1b42 100644 (file)
@@ -91,6 +91,9 @@ production.
   page. During the deprecation period, the styles will only be loaded on pages
   which contain 'mw-ui-button' in their HTML. Starting in 1.28, the styles will
   only be loaded if explicitly required.
+* If search returns zero results and current search engine has a "did you mean"
+  suggestion, results for suggestion will be shown. Can be disabled by setting
+  $wgSearchRunSuggestedQuery to false.
 
 ==== External libraries ====
 * Update es5-shim from v4.0.0 to v4.1.5.
index 8b220f3..f58b339 100644 (file)
@@ -7706,14 +7706,13 @@ $wgVirtualRestConfig = array(
 );
 
 /**
- * Controls the percentage of zero-result search queries with suggestions that
- * run the suggestion automatically. Must be a number between 0 and 1.  This
- * can be lowered to reduce query volume at the expense of result quality.
+ * Controls whether zero-result search queries with suggestions should display results for
+ * these suggestions.
  *
- * @var float
+ * @var bool
  * @since 1.26
  */
-$wgSearchRunSuggestedQueryPercent = 1;
+$wgSearchRunSuggestedQuery = true;
 
 /**
  * For really cool vim folding this needs to be at the end:
index d806be3..3f67e93 100644 (file)
@@ -415,10 +415,7 @@ class SpecialSearch extends SpecialPage {
                        return false;
                }
 
-               // Generate a random number between 0 and 1. If the
-               // number is less than the desired percentages run it.
-               $rand = rand( 0, getrandmax() ) / getrandmax();
-               return $this->getConfig()->get( 'SearchRunSuggestedQueryPercent' ) > $rand;
+               return $this->getConfig()->get( 'SearchRunSuggestedQuery' );
        }
 
        /**