Revision: 49535
Author:   rainman
Date:     2009-04-15 22:39:12 +0000 (Wed, 15 Apr 2009)

Log Message:
-----------
Add support for $wgLucenePrefixHost, i.e. for hitting custom servers on 
type-ahead prefix searches. 

Modified Paths:
--------------
    trunk/extensions/MWSearch/MWSearch_body.php

Modified: trunk/extensions/MWSearch/MWSearch_body.php
===================================================================
--- trunk/extensions/MWSearch/MWSearch_body.php 2009-04-15 22:23:31 UTC (rev 
49534)
+++ trunk/extensions/MWSearch/MWSearch_body.php 2009-04-15 22:39:12 UTC (rev 
49535)
@@ -435,11 +435,18 @@
                global $wgLuceneSearchVersion, $wgLuceneSearchCacheExpiry;
                global $wgLuceneSearchTimeout;
                
-               if( is_array( $wgLuceneHost ) ) {
-                       $pick = mt_rand( 0, count( $wgLuceneHost ) - 1 );
-                       $host = $wgLuceneHost[$pick];
+               $hosts = $wgLuceneHost;
+               if( $method == 'prefix'){
+                       global $wgLucenePrefixHost;
+                       if( isset($wgLucenePrefixHost) )
+                               $hosts = $wgLucenePrefixHost;
+               }
+                       
+               if( is_array( $hosts ) ) {
+                       $pick = mt_rand( 0, count( $hosts ) - 1 );
+                       $host = $hosts[$pick];
                } else {
-                       $host = $wgLuceneHost;
+                       $host = $hosts;
                }
                
                $enctext = rawurlencode( trim( $query ) );



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to