Index: trunk/phase3/includes/SearchEngine.php |
— | — | @@ -13,6 +13,7 @@ |
14 | 14 | class SearchEngine { |
15 | 15 | var $limit = 10; |
16 | 16 | var $offset = 0; |
| 17 | + var $prefix = ''; |
17 | 18 | var $searchTerms = array(); |
18 | 19 | var $namespaces = array( NS_MAIN ); |
19 | 20 | var $showRedirects = false; |
Index: trunk/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -115,10 +115,17 @@ |
116 | 116 | public function showResults( $term ) { |
117 | 117 | global $wgOut, $wgDisableTextSearch, $wgContLang; |
118 | 118 | wfProfileIn( __METHOD__ ); |
119 | | - |
120 | | - $this->setupPage( $term ); |
| 119 | + |
121 | 120 | $this->searchEngine = SearchEngine::create(); |
| 121 | + $search =& $this->searchEngine; |
| 122 | + $search->setLimitOffset( $this->limit, $this->offset ); |
| 123 | + $search->setNamespaces( $this->namespaces ); |
| 124 | + $search->showRedirects = $this->searchRedirects; |
| 125 | + $search->prefix = $this->mPrefix; |
| 126 | + $term = $search->transformSearchTerm($term); |
122 | 127 | |
| 128 | + $this->setupPage( $term ); |
| 129 | + |
123 | 130 | if( $wgDisableTextSearch ) { |
124 | 131 | global $wgSearchForwardUrl; |
125 | 132 | if( $wgSearchForwardUrl ) { |
— | — | @@ -144,13 +151,8 @@ |
145 | 152 | } |
146 | 153 | |
147 | 154 | $t = Title::newFromText( $term ); |
148 | | - // fetch search results |
149 | | - $search =& $this->searchEngine; |
150 | | - $search->setLimitOffset( $this->limit, $this->offset ); |
151 | | - $search->setNamespaces( $this->namespaces ); |
152 | | - $search->showRedirects = $this->searchRedirects; |
153 | | - $search->prefix = $this->mPrefix; |
154 | | - $term = $search->transformSearchTerm($term); |
| 155 | + |
| 156 | + // fetch search results |
155 | 157 | $rewritten = $search->replacePrefixes($term); |
156 | 158 | |
157 | 159 | $titleMatches = $search->searchTitle( $rewritten ); |
— | — | @@ -854,7 +856,7 @@ |
855 | 857 | */ |
856 | 858 | function __construct( &$request, &$user ) { |
857 | 859 | list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, 'searchlimit' ); |
858 | | - |
| 860 | + $this->mPrefix = $request->getVal('prefix', ''); |
859 | 861 | $this->namespaces = $this->powerSearch( $request ); |
860 | 862 | if( empty( $this->namespaces ) ) { |
861 | 863 | $this->namespaces = SearchEngine::userNamespaces( $user ); |
— | — | @@ -919,6 +921,13 @@ |
920 | 922 | global $wgOut, $wgUser; |
921 | 923 | $sk = $wgUser->getSkin(); |
922 | 924 | |
| 925 | + $search = SearchEngine::create(); |
| 926 | + $search->setLimitOffset( $this->limit, $this->offset ); |
| 927 | + $search->setNamespaces( $this->namespaces ); |
| 928 | + $search->showRedirects = $this->searchRedirects; |
| 929 | + $search->prefix = $this->mPrefix; |
| 930 | + $term = $search->transformSearchTerm($term); |
| 931 | + |
923 | 932 | $this->setupPage( $term ); |
924 | 933 | |
925 | 934 | $wgOut->addWikiMsg( 'searchresulttext' ); |
— | — | @@ -957,12 +966,7 @@ |
958 | 967 | return; |
959 | 968 | } |
960 | 969 | |
961 | | - $wgOut->addHTML( $this->shortDialog( $term ) ); |
962 | | - |
963 | | - $search = SearchEngine::create(); |
964 | | - $search->setLimitOffset( $this->limit, $this->offset ); |
965 | | - $search->setNamespaces( $this->namespaces ); |
966 | | - $search->showRedirects = $this->searchRedirects; |
| 970 | + $wgOut->addHTML( $this->shortDialog( $term ) ); |
967 | 971 | $rewritten = $search->replacePrefixes($term); |
968 | 972 | |
969 | 973 | $titleMatches = $search->searchTitle( $rewritten ); |