} elseif ( $what == 'title' ) {
$matches = $search->searchTitle( $query );
} elseif ( $what == 'nearmatch' ) {
- $matches = SearchEngine::getNearMatchResultSet( $query );
+ // near matches must receive the user input as provided, otherwise
+ // the near matches within namespaces are lost.
+ $matches = SearchEngine::getNearMatchResultSet( $params['search'] );
} else {
// We default to title searches; this is a terrible legacy
// of the way we initially set up the MySQL fulltext-based
if ( isset( $searchInfo['suggestion'] ) && $matches->hasSuggestion() ) {
$apiResult->addValue( array( 'query', 'searchinfo' ),
'suggestion', $matches->getSuggestionQuery() );
+ $apiResult->addValue( array( 'query', 'searchinfo' ),
+ 'suggestionsnippet', $matches->getSuggestionSnippet() );
}
}
if ( isset( $prop['titlesnippet'] ) ) {
$vals['titlesnippet'] = $result->getTitleSnippet();
}
+ if ( isset( $prop['categorysnippet'] ) ) {
+ $vals['categorysnippet'] = $result->getCategorySnippet();
+ }
if ( !is_null( $result->getRedirectTitle() ) ) {
if ( isset( $prop['redirecttitle'] ) ) {
$vals['redirecttitle'] = $result->getRedirectTitle()->getPrefixedText();
$vals['sectionsnippet'] = $result->getSectionSnippet();
}
}
+ if ( isset( $prop['isfilematch'] ) ) {
+ $vals['isfilematch'] = $result->isFileMatch();
+ }
// Add item to results and see whether it fits
$fit = $apiResult->addValue( array( 'query', $this->getModuleName() ),
'sectiontitle',
'sectionsnippet',
'hasrelated',
+ 'isfilematch',
+ 'categorysnippet',
),
ApiBase::PARAM_ISMULTI => true,
),