Index: trunk/extensions/SphinxSearch/SphinxMWSearch.php |
— | — | @@ -19,7 +19,6 @@ |
20 | 20 | var $db; |
21 | 21 | var $sphinx_client = null; |
22 | 22 | var $prefix_handlers = array( |
23 | | - 'all' => 'searchAllNamespaces', |
24 | 23 | 'intitle' => 'filterByTitle', |
25 | 24 | 'incategory' => 'filterByCategory', |
26 | 25 | 'prefix' => 'filterByPrefix', |
— | — | @@ -216,28 +215,25 @@ |
217 | 216 | function preparePrefixRegexp() { |
218 | 217 | global $wgContLang, $wgCanonicalNamespaceNames, $wgNamespaceAliases; |
219 | 218 | |
220 | | - $nsNamesRaw = array_merge( |
| 219 | + // "search everything" keyword |
| 220 | + $allkeyword = wfMsgForContent( 'searchall' ); |
| 221 | + $this->prefix_handlers[ $allkeyword ] = 'searchAllNamespaces'; |
| 222 | + |
| 223 | + $all_prefixes = array_merge( |
221 | 224 | $wgContLang->getNamespaces(), |
222 | 225 | $wgCanonicalNamespaceNames, |
223 | | - array_keys( array_merge( $wgNamespaceAliases, $wgContLang->getNamespaceAliases() ) ) |
| 226 | + array_keys( array_merge( $wgNamespaceAliases, $wgContLang->getNamespaceAliases() ) ), |
| 227 | + array_keys( $this->prefix_handlers ) |
224 | 228 | ); |
225 | 229 | |
226 | | - // add all namespace names w/o spaces |
227 | | - $nsNames = array(); |
228 | | - foreach ( $nsNamesRaw as $ns ) { |
229 | | - if ( $ns != '' ) { |
230 | | - $nsNames[] = str_replace( ' ', '_', $ns ); |
| 230 | + $regexp_prefixes = array(); |
| 231 | + foreach ( $all_prefixes as $prefix ) { |
| 232 | + if ( $prefix != '' ) { |
| 233 | + $regexp_prefixes[] = preg_quote( str_replace( ' ', '_', $prefix ) ); |
231 | 234 | } |
232 | 235 | } |
233 | 236 | |
234 | | - // "search everything" keyword |
235 | | - $allkeyword = wfMsgForContent( 'searchall' ); |
236 | | - $this->prefix_handlers[ $allkeyword ] = 'searchAllNamespaces'; |
237 | | - |
238 | | - // add other kinds of prefixes we support |
239 | | - $nsNames = array_merge( $nsNames, array_keys( $this->prefix_handlers ) ); |
240 | | - |
241 | | - return implode( '|', array_unique( $nsNames ) ); |
| 237 | + return implode( '|', array_unique( $regexp_prefixes ) ); |
242 | 238 | } |
243 | 239 | |
244 | 240 | /** |