r45215 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45214‎ | r45215 | r45216 >
Date:03:33, 31 December 2008
Author:rainman
Status:ok
Tags:
Comment:
Pair to previous commit: handle the 'prefix' param - the default backend will just save it into variable and ignore it.
Modified paths:
  • /trunk/phase3/includes/SearchEngine.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -63,6 +63,7 @@
6464 */
6565 function __construct( &$request, &$user ) {
6666 list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, 'searchlimit' );
 67+ $this->mPrefix = $request->getVal('prefix', '');
6768 # Extract requested namespaces
6869 $this->namespaces = $this->powerSearch( $request );
6970 if( empty( $this->namespaces ) ) {
@@ -148,6 +149,8 @@
149150 $search->setLimitOffset( $this->limit, $this->offset );
150151 $search->setNamespaces( $this->namespaces );
151152 $search->showRedirects = $this->searchRedirects;
 153+ $search->prefix = $this->mPrefix;
 154+ $term = $search->transformSearchTerm($term);
152155 $rewritten = $search->replacePrefixes($term);
153156
154157 $titleMatches = $search->searchTitle( $rewritten );
Index: trunk/phase3/includes/SearchEngine.php
@@ -49,6 +49,14 @@
5050 }
5151
5252 /**
 53+ * Transform search term in cases when parts of the query came as different GET params (when supported)
 54+ * e.g. for prefix queries: search=test&prefix=Main_Page/Archive -> test prefix:Main Page/Archive
 55+ */
 56+ function transformSearchTerm( $term ) {
 57+ return $term;
 58+ }
 59+
 60+ /**
5361 * If an exact title match can be find, or a very slightly close match,
5462 * return the title. If no match, returns NULL.
5563 *

Follow-up revisions

RevisionCommit summaryAuthorDate
r45217Backport r45215 to old search ui and move search engine creation before page ...rainman04:48, 31 December 2008

Status & tagging log