r49535 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49534‎ | r49535 | r49536 >
Date:22:39, 15 April 2009
Author:rainman
Status:deferred
Tags:
Comment:
Add support for $wgLucenePrefixHost, i.e. for hitting custom servers on type-ahead prefix searches.
Modified paths:
  • /trunk/extensions/MWSearch/MWSearch_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MWSearch/MWSearch_body.php
@@ -435,11 +435,18 @@
436436 global $wgLuceneSearchVersion, $wgLuceneSearchCacheExpiry;
437437 global $wgLuceneSearchTimeout;
438438
439 - if( is_array( $wgLuceneHost ) ) {
440 - $pick = mt_rand( 0, count( $wgLuceneHost ) - 1 );
441 - $host = $wgLuceneHost[$pick];
 439+ $hosts = $wgLuceneHost;
 440+ if( $method == 'prefix'){
 441+ global $wgLucenePrefixHost;
 442+ if( isset($wgLucenePrefixHost) )
 443+ $hosts = $wgLucenePrefixHost;
 444+ }
 445+
 446+ if( is_array( $hosts ) ) {
 447+ $pick = mt_rand( 0, count( $hosts ) - 1 );
 448+ $host = $hosts[$pick];
442449 } else {
443 - $host = $wgLuceneHost;
 450+ $host = $hosts;
444451 }
445452
446453 $enctext = rawurlencode( trim( $query ) );

Status & tagging log