r4795 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r4794‎ | r4795 | r4796 >
Date:05:05, 15 August 2004
Author:vibber
Status:old
Tags:
Comment:
Show the search terms as given instead of the filtered terms in the subtitle.
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
Modified paths:
  • /trunk/phase3/includes/SearchEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SearchEngine.php
@@ -2,7 +2,7 @@
33 # See search.doc
44
55 class SearchEngine {
6 - /* private */ var $mUsertext, $mSearchterms;
 6+ /* private */ var $mRawtext, $mUsertext, $mSearchterms;
77 /* private */ var $mTitlecond, $mTextcond;
88
99 var $doSearchRedirects = true;
@@ -18,6 +18,7 @@
1919 global $wgDBmysql4;
2020 $lc = SearchEngine::legalSearchChars() . "()";
2121 if( $wgDBmysql4 ) $lc .= "\"~<>*+-";
 22+ $this->mRawtext = $text;
2223 $this->mUsertext = trim( preg_replace( "/[^{$lc}]/", " ", $text ) );
2324 $this->mSearchterms = array();
2425 $this->mStrictMatching = true; # Google-style, add '+' on all terms
@@ -146,7 +147,7 @@
147148 function setupPage() {
148149 global $wgOut;
149150 $wgOut->setPageTitle( wfMsg( "searchresults" ) );
150 - $q = wfMsg( "searchquery", htmlspecialchars( $this->mUsertext ) );
 151+ $q = wfMsg( "searchquery", htmlspecialchars( $this->mRawtext ) );
151152 $wgOut->setSubtitle( $q );
152153 $wgOut->setArticleRelated( false );
153154 $wgOut->setRobotpolicy( "noindex,nofollow" );
@@ -476,7 +477,7 @@
477478 }
478479
479480 # No match, generate an edit URL
480 - $t = Title::newFromText( $wgRequest->getText( "search" ) );
 481+ $t = Title::newFromText( $this->mRawtext );
481482
482483 # If the feature is enabled, go straight to the edit page
483484 if ( $wgGoToEdit ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r4792Use original instead of filtered search request for the optional new page edi...vibber04:38, 15 August 2004
r4793Use original instead of filtered search request for the optional new page edi...vibber04:42, 15 August 2004
r4794One more tweak for the page subtitle. Fix for...vibber05:02, 15 August 2004

Status & tagging log