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 );
}
$out->wrapWikiMsg( "==$1==\n", 'textmatches' );
}
- // show interwiki results if any
- if ( $textMatches->hasInterwikiResults() ) {
- $out->addHTML( $this->showInterwiki( $textMatches->getInterwikiResults(), $term ) );
- }
// show results
if ( $numTextMatches > 0 ) {
$out->addHTML( $this->showMatches( $textMatches ) );
}
+ // show interwiki results if any
+ if ( $textMatches->hasInterwikiResults() ) {
+ $out->addHTML( $this->showInterwiki( $textMatches->getInterwikiResults(), $term ) );
+ }
$textMatches->free();
}
$this->showCreateLink( $title, $num, $titleMatches, $textMatches );
}
}
- $out->addHtml( "</div>" );
+ $out->addHTML( '<div class="visualClear"></div>\n' );
if ( $prevnext ) {
$out->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
}
+ $out->addHtml( "</div>" );
+
Hooks::run( 'SpecialSearchResultsAppend', array( $this, $out ) );
}
// 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
);
return Html::rawElement(
'div',
array( 'class' => 'searchdidyoumean' ),
- $this->msg( 'search-rewritten')->rawParams( $rewritten, $original )->escaped()
+ $this->msg( 'search-rewritten' )->rawParams( $rewritten, $original )->escaped()
);
}