De-duplicate near match query terms when generating variants
authornomoa <nomoa@laposte.net>
Tue, 12 Jan 2016 01:22:25 +0000 (17:22 -0800)
committerdcausse <dcausse@wikimedia.org>
Tue, 12 Jan 2016 01:33:00 +0000 (17:33 -0800)
zhwiki generates 9 variants: we should not run these queries if the term is unchanged.

Change-Id: If23d19761dea33bf4bdcf6495becc8e983915fde

includes/search/SearchEngine.php

index e5ed23f..3c8d56e 100644 (file)
@@ -164,10 +164,10 @@ class SearchEngine {
                $allSearchTerms = array( $searchterm );
 
                if ( $wgContLang->hasVariants() ) {
-                       $allSearchTerms = array_merge(
+                       $allSearchTerms = array_unique( array_merge(
                                $allSearchTerms,
                                $wgContLang->autoConvertToAllVariants( $searchterm )
-                       );
+                       ) );
                }
 
                $titleResult = null;