Index: trunk/extensions/MWSearch/MWSearch.php |
— | — | @@ -39,15 +39,22 @@ |
40 | 40 | # - it's in the 'lucene-search' and 'mwsearch' modules in CVS. |
41 | 41 | ########## |
42 | 42 | |
43 | | -# If to show related links (if available) below search results |
44 | | -$wgLuceneUseRelated = true; |
45 | 43 | |
46 | 44 | # Back-end version (override before including MWSearch.php) |
47 | 45 | if( !isset($wgLuceneSearchVersion) ) |
48 | 46 | $wgLuceneSearchVersion = 2; |
| 47 | + |
| 48 | +# If to show related links (if available) below search results |
| 49 | +if( !isset($wgLuceneUseRelated) ) |
| 50 | + $wgLuceneUseRelated = false; |
| 51 | + |
| 52 | +# If to use lucene as a prefix search backend |
| 53 | +if( !isset($wgEnableLucenePrefixSearch) ) |
| 54 | + $wgEnableLucenePrefixSearch = false; |
| 55 | + |
49 | 56 | # For how long (in seconds) to cache lucene results, off by default (0) |
50 | 57 | # NOTE: caching is typically inefficient for queries, with cache |
51 | | -# hit rates way below 1% even for very long expiry times |
| 58 | +# hit rates way below 1% even for very long expiry times |
52 | 59 | if( !isset($wgLuceneSearchCacheExpiry) ) |
53 | 60 | $wgLuceneSearchCacheExpiry = 0; |
54 | 61 | |
— | — | @@ -64,7 +71,7 @@ |
65 | 72 | ); |
66 | 73 | $wgExtensionMessagesFiles['MWSearch'] = dirname(__FILE__) . '/MWSearch.i18n.php'; |
67 | 74 | |
68 | | -if($wgLuceneSearchVersion >= 2.1) |
| 75 | +if($wgLuceneSearchVersion >= 2.1 && $wgEnableLucenePrefixSearch) |
69 | 76 | $wgHooks['PrefixSearchBackend'][] = 'LuceneSearch::prefixSearch'; |
70 | 77 | |
71 | 78 | function wfLuceneSearch() { |
— | — | @@ -676,7 +683,7 @@ |
677 | 684 | function termMatches() { |
678 | 685 | $resq = preg_replace( "/\\[.*?\\]:/", " ", $this->mQuery ); # generic prefixes |
679 | 686 | $resq = preg_replace( "/all:/", " ", $resq ); |
680 | | - $resq = trim( preg_replace( "/[ |\\[\\]()\"{}+]+/", " ", $resq ) ); |
| 687 | + $resq = trim( preg_replace( "/[ |\\[\\]()\"{}+\\-_@!?%&*=\\|:;><,.\\/]+/", " ", $resq ) ); |
681 | 688 | $terms = array_map( array( &$this, 'regexQuote' ), |
682 | 689 | explode( ' ', $resq ) ); |
683 | 690 | return $terms; |