search: did you mean should always go to SERP
authorErik Bernhardson <ebernhardson@wikimedia.org>
Mon, 13 Jun 2016 16:41:03 +0000 (09:41 -0700)
committerErik Bernhardson <ebernhardson@wikimedia.org>
Mon, 13 Jun 2016 21:32:53 +0000 (14:32 -0700)
Did you mean had an odd inconcistency, where if you came to
Special:Search from autocomplete and click a did you mean link to an
exact title match, you would be sent to the page rather than a results
page. This seems odd and inconsistent, so always provide the 'fulltext'
parameter to disable the 'go' feature.

Change-Id: I8c80505053cd04b67afbe2139415fb0a44d954b4

includes/specials/SpecialSearch.php

index b98ddda..a779b66 100644 (file)
@@ -485,7 +485,9 @@ class SpecialSearch extends SpecialPage {
        protected function getDidYouMeanHtml( SearchResultSet $textMatches ) {
                # mirror Go/Search behavior of original request ..
                $params = [ 'search' => $textMatches->getSuggestionQuery() ];
-               if ( $this->fulltext != null ) {
+               if ( $this->fulltext === null ) {
+                       $params['fulltext'] = 'Search';
+               } else {
                        $params['fulltext'] = $this->fulltext;
                }
                $stParams = array_merge( $params, $this->powerSearchOptions() );
@@ -519,7 +521,9 @@ class SpecialSearch extends SpecialPage {
                // Search instead for '$orig'
 
                $params = [ 'search' => $textMatches->getQueryAfterRewrite() ];
-               if ( $this->fulltext != null ) {
+               if ( $this->fulltext === null ) {
+                       $params['fulltext'] = 'Search';
+               } else {
                        $params['fulltext'] = $this->fulltext;
                }
                $stParams = array_merge( $params, $this->powerSearchOptions() );