From: Robert Stojnić Date: Wed, 31 Dec 2008 03:33:08 +0000 (+0000) Subject: Pair to previous commit: handle the 'prefix' param - the default backend will just... X-Git-Tag: 1.31.0-rc.0~43682 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=4115586000a575eb814a80868c817d18ee169d3b;p=lhc%2Fweb%2Fwiklou.git Pair to previous commit: handle the 'prefix' param - the default backend will just save it into variable and ignore it. --- diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 9aee994538..bf0a722b62 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -48,6 +48,14 @@ class SearchEngine { return true; } + /** + * Transform search term in cases when parts of the query came as different GET params (when supported) + * e.g. for prefix queries: search=test&prefix=Main_Page/Archive -> test prefix:Main Page/Archive + */ + function transformSearchTerm( $term ) { + return $term; + } + /** * If an exact title match can be find, or a very slightly close match, * return the title. If no match, returns NULL. diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 279f8b7d85..90cbca567b 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -63,6 +63,7 @@ class SpecialSearch { */ function __construct( &$request, &$user ) { list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, 'searchlimit' ); + $this->mPrefix = $request->getVal('prefix', ''); # Extract requested namespaces $this->namespaces = $this->powerSearch( $request ); if( empty( $this->namespaces ) ) { @@ -148,6 +149,8 @@ class SpecialSearch { $search->setLimitOffset( $this->limit, $this->offset ); $search->setNamespaces( $this->namespaces ); $search->showRedirects = $this->searchRedirects; + $search->prefix = $this->mPrefix; + $term = $search->transformSearchTerm($term); $rewritten = $search->replacePrefixes($term); $titleMatches = $search->searchTitle( $rewritten );