private function searchTextSecondTry($term, ResultSet $zeroResult)
 {
     // TODO: figure out who goes first - language or suggestion?
     if ($zeroResult->hasSuggestion()) {
         $rewritten = $zeroResult->getSuggestionQuery();
         $rewrittenSnippet = $zeroResult->getSuggestionSnippet();
         $this->showSuggestion = false;
     } else {
         $altWiki = $this->hasSecondaryLanguage($term);
         if ($altWiki) {
             try {
                 $config = new SearchConfig($altWiki[0], $altWiki[1]);
             } catch (MWException $e) {
                 wfDebug("Failed to get {$altWiki} config: {$e->getMessage()}");
                 $config = null;
             }
             if ($config) {
                 $matches = $this->searchTextReal($term, $config);
                 return $matches;
             }
         }
         // Don't have any other options yet.
         return $zeroResult;
     }
     $rewrittenResult = $this->searchTextReal($rewritten);
     if ($rewrittenResult instanceof ResultSet && $rewrittenResult->numRows() > 0) {
         $rewrittenResult->setRewrittenQuery($rewritten, $rewrittenSnippet);
         return $rewrittenResult;
     } else {
         return $zeroResult;
     }
 }
 private function searchTextSecondTry($term, ResultSet $oldResult)
 {
     // TODO: figure out who goes first - language or suggestion?
     if ($oldResult->numRows() == 0 && $oldResult->hasSuggestion()) {
         $rewritten = $oldResult->getSuggestionQuery();
         $rewrittenSnippet = $oldResult->getSuggestionSnippet();
         $this->showSuggestion = false;
         $rewrittenResult = $this->searchTextReal($rewritten);
         if ($rewrittenResult instanceof ResultSet && $rewrittenResult->numRows() > 0) {
             $rewrittenResult->setRewrittenQuery($rewritten, $rewrittenSnippet);
             if ($rewrittenResult->numRows() < $GLOBALS['wgCirrusSearchInterwikiThreshold']) {
                 // replace the result but still try the alt language
                 $oldResult = $rewrittenResult;
             } else {
                 return $rewrittenResult;
             }
         }
     }
     $altWiki = $this->hasSecondaryLanguage($term);
     if ($altWiki) {
         try {
             $config = new SearchConfig($altWiki[0], $altWiki[1]);
         } catch (MWException $e) {
             LoggerFactory::getInstance('CirrusSearch')->info("Failed to get config for {interwiki}:{dbwiki}", array("interwiki" => $altWiki[0], "dbwiki" => $altWiki[1], "exception" => $e));
             $config = null;
         }
         if ($config) {
             $matches = $this->searchTextReal($term, $config);
             if ($matches instanceof ResultSet && $matches->numRows() > 0) {
                 $oldResult->addInterwikiResults($matches, SearchResultSet::INLINE_RESULTS, $altWiki[1]);
             }
         }
     }
     // Don't have any other options yet.
     return $oldResult;
 }