global $wgContLang;
$search = $this->getSearchEngine();
+ $search->setFeatureData( 'rewrite', $this->runSuggestion );
$search->setLimitOffset( $this->limit, $this->offset );
$search->setNamespaces( $this->namespaces );
$search->prefix = $this->mPrefix;
// did you mean... suggestions
$didYouMeanHtml = '';
if ( $showSuggestion && $textMatches && !$textStatus ) {
- if ( $this->shouldRunSuggestedQuery( $textMatches ) ) {
- $newMatches = $search->searchText( $textMatches->getSuggestionQuery() );
- if ( $newMatches instanceof SearchResultSet && $newMatches->numRows() > 0 ) {
- $didYouMeanHtml = $this->getDidYouMeanRewrittenHtml( $term, $textMatches );
- $textMatches = $newMatches;
- }
+ if ( $textMatches->hasRewrittenQuery() ) {
+ $didYouMeanHtml = $this->getDidYouMeanRewrittenHtml( $term, $textMatches );
} elseif ( $textMatches->hasSuggestion() ) {
$didYouMeanHtml = $this->getDidYouMeanHtml( $textMatches );
}
// Showing results for '$rewritten'
// Search instead for '$orig'
- $params = array( 'search' => $textMatches->getSuggestionQuery() );
+ $params = array( 'search' => $textMatches->getQueryAfterRewrite() );
if ( $this->fulltext != null ) {
$params['fulltext'] = $this->fulltext;
}
$rewritten = Linker::linkKnown(
$this->getPageTitle(),
- $textMatches->getSuggestionSnippet() ?: null,
+ $textMatches->getQueryAfterRewriteSnippet() ?: null,
array(),
$stParams
);