From 4115586000a575eb814a80868c817d18ee169d3b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Robert=20Stojni=C4=87?= Date: Wed, 31 Dec 2008 03:33:08 +0000 Subject: [PATCH] Pair to previous commit: handle the 'prefix' param - the default backend will just save it into variable and ignore it. --- includes/SearchEngine.php | 8 ++++++++ includes/specials/SpecialSearch.php | 3 +++ 2 files changed, 11 insertions(+) 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 ); -- 2.20.1