Merge "includes/Linker.php: Added hook for "Media:" links"
[lhc/web/wiklou.git] / includes / api / ApiOpenSearch.php
index f2bf754..68b62af 100644 (file)
@@ -60,28 +60,8 @@ class ApiOpenSearch extends ApiBase {
                        $this->getMain()->setCacheMaxAge( $wgSearchSuggestCacheExpiry );
                        $this->getMain()->setCacheMode( 'public' );
 
-                       $searches = PrefixSearch::titleSearch( $search, $limit,
-                               $namespaces );
-
-                       // if the content language has variants, try to retrieve fallback results
-                       $fallbackLimit = $limit - count( $searches );
-                       if ( $fallbackLimit > 0 ) {
-                               global $wgContLang;
-
-                               $fallbackSearches = $wgContLang->autoConvertToAllVariants( $search );
-                               $fallbackSearches = array_diff( array_unique( $fallbackSearches ), array( $search ) );
-
-                               foreach ( $fallbackSearches as $fbs ) {
-                                       $fallbackSearchResult = PrefixSearch::titleSearch( $fbs, $fallbackLimit,
-                                               $namespaces );
-                                       $searches = array_merge( $searches, $fallbackSearchResult );
-                                       $fallbackLimit -= count( $fallbackSearchResult );
-
-                                       if ( $fallbackLimit == 0 ) {
-                                               break;
-                                       }
-                               }
-                       }
+                       $searcher = new StringPrefixSearch;
+                       $searches = $searcher->searchWithVariants( $search, $limit, $namespaces );
                }
                // Set top level elements
                $result = $this->getResult();