From: Robert Stojnić Date: Sat, 21 Mar 2009 10:51:08 +0000 (+0000) Subject: (bug 17405) have "Did you mean..." mirror the Go/Search character of original request. X-Git-Tag: 1.31.0-rc.0~42422 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=b564fa66d0ad9408db03ba8507c261acb042e7dd;p=lhc%2Fweb%2Fwiklou.git (bug 17405) have "Did you mean..." mirror the Go/Search character of original request. If the user reached the search page using "Go", "Did you mean" will also use "Go" and directly link to article. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ad58121b29..3fa1f9b794 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -279,6 +279,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 18018) Deleting a file redirect leaves behind a malfunctioning redirect * (bug 17537) Disable bad zlib.output_compression output on HTTP 304 responses * (bug 11213) [edit] section links in printable version no longer appear when you cut-and-paste article text +* (bug 17405) "Did you mean" to mirror Go/Search behavior of original request == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 694ab64dfb..cb7838199c 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -74,6 +74,7 @@ class SpecialSearch { $this->active = 'advanced'; $this->sk = $user->getSkin(); $this->didYouMeanHtml = ''; # html of did you mean... link + $this->fulltext = $request->getVal('fulltext'); } /** @@ -163,9 +164,13 @@ class SpecialSearch { // did you mean... suggestions if( $textMatches && $textMatches->hasSuggestion() ) { - $st = SpecialPage::getTitleFor( 'Search' ); + $st = SpecialPage::getTitleFor( 'Search' ); + # mirror Go/Search behaviour of original request .. + $didYouMeanParams = array( 'search' => $textMatches->getSuggestionQuery() ); + if($this->fulltext != NULL) + $didYouMeanParams['fulltext'] = $this->fulltext; $stParams = wfArrayToCGI( - array( 'search' => $textMatches->getSuggestionQuery(), 'fulltext' => wfMsg('search') ), + $didYouMeanParams, $this->powerSearchOptions() ); $suggestLink = $sk->makeKnownLinkObj( $st, @@ -856,6 +861,7 @@ class SpecialSearchOld { } $this->searchRedirects = $request->getcheck( 'redirs' ) ? true : false; + $this->fulltext = $request->getVal('fulltext'); } /** @@ -929,11 +935,16 @@ class SpecialSearchOld { // did you mean... suggestions if($textMatches && $textMatches->hasSuggestion()){ - $st = SpecialPage::getTitleFor( 'Search' ); - $stParams = wfArrayToCGI( array( - 'search' => $textMatches->getSuggestionQuery(), - 'fulltext' => wfMsg('search')), - $this->powerSearchOptions()); + $st = SpecialPage::getTitleFor( 'Search' ); + + # mirror Go/Search behaviour of original request + $didYouMeanParams = array( 'search' => $textMatches->getSuggestionQuery() ); + if($this->fulltext != NULL) + $didYouMeanParams['fulltext'] = $this->fulltext; + $stParams = wfArrayToCGI( + $didYouMeanParams, + $this->powerSearchOptions() + ); $suggestLink = $sk->makeKnownLinkObj( $st, $textMatches->getSuggestionSnippet(),