From: Max Semenik Date: Fri, 25 Sep 2015 21:01:00 +0000 (-0700) Subject: Turn $wgSearchRunSuggestedQueryPercent into $wgSearchRunSuggestedQuery X-Git-Tag: 1.31.0-rc.0~9820^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=ba5bea7a713c38f62bfb7c7ca2050648e26732e8;p=lhc%2Fweb%2Fwiklou.git Turn $wgSearchRunSuggestedQueryPercent into $wgSearchRunSuggestedQuery 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 --- diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index a13fc2e145..aab1b4254c 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -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. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 8b220f33de..f58b339bb4 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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: diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index d806be3ac6..3f67e93d1d 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -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' ); } /**