Index: trunk/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -63,6 +63,7 @@ |
64 | 64 | */ |
65 | 65 | function __construct( &$request, &$user ) { |
66 | 66 | list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, 'searchlimit' ); |
| 67 | + $this->mPrefix = $request->getVal('prefix', ''); |
67 | 68 | # Extract requested namespaces |
68 | 69 | $this->namespaces = $this->powerSearch( $request ); |
69 | 70 | if( empty( $this->namespaces ) ) { |
— | — | @@ -148,6 +149,8 @@ |
149 | 150 | $search->setLimitOffset( $this->limit, $this->offset ); |
150 | 151 | $search->setNamespaces( $this->namespaces ); |
151 | 152 | $search->showRedirects = $this->searchRedirects; |
| 153 | + $search->prefix = $this->mPrefix; |
| 154 | + $term = $search->transformSearchTerm($term); |
152 | 155 | $rewritten = $search->replacePrefixes($term); |
153 | 156 | |
154 | 157 | $titleMatches = $search->searchTitle( $rewritten ); |
Index: trunk/phase3/includes/SearchEngine.php |
— | — | @@ -49,6 +49,14 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
| 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 | + /** |
53 | 61 | * If an exact title match can be find, or a very slightly close match, |
54 | 62 | * return the title. If no match, returns NULL. |
55 | 63 | * |