Show the search terms as given instead of the filtered terms in the subtitle.
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 15 Aug 2004 05:05:56 +0000 (05:05 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 15 Aug 2004 05:05:56 +0000 (05:05 +0000)
Part of the fix for Bug 54: go-search for non-existing page in a namespace returns broken new-edit URL
http://bugzilla.wikipedia.org/show_bug.cgi?id=54

includes/SearchEngine.php

index 4e64287..4e01ee7 100644 (file)
@@ -2,7 +2,7 @@
 # See search.doc
 
 class SearchEngine {
-       /* private */ var $mUsertext, $mSearchterms;
+       /* private */ var $mRawtext, $mUsertext, $mSearchterms;
        /* private */ var $mTitlecond, $mTextcond;
 
        var $doSearchRedirects = true;
@@ -18,6 +18,7 @@ class SearchEngine {
                global $wgDBmysql4;
                $lc = SearchEngine::legalSearchChars() . "()";
                if( $wgDBmysql4 ) $lc .= "\"~<>*+-";
+               $this->mRawtext = $text;
                $this->mUsertext = trim( preg_replace( "/[^{$lc}]/", " ", $text ) );
                $this->mSearchterms = array();
                $this->mStrictMatching = true; # Google-style, add '+' on all terms
@@ -146,7 +147,7 @@ class SearchEngine {
        function setupPage() {
                global $wgOut;
                $wgOut->setPageTitle( wfMsg( "searchresults" ) );
-               $q = wfMsg( "searchquery", htmlspecialchars( $this->mUsertext ) );
+               $q = wfMsg( "searchquery", htmlspecialchars( $this->mRawtext ) );
                $wgOut->setSubtitle( $q );
                $wgOut->setArticleRelated( false );
                $wgOut->setRobotpolicy( "noindex,nofollow" );
@@ -476,7 +477,7 @@ class SearchEngine {
                }
 
                # No match, generate an edit URL
-               $t = Title::newFromText( $wgRequest->getText( "search" ) );
+               $t = Title::newFromText( $this->mRawtext );
                
                # If the feature is enabled, go straight to the edit page
                if ( $wgGoToEdit ) {