* @file
*/
-use MediaWiki\MediaWikiServices;
-
/**
* Query module to perform full text search within wiki titles and content
*
}
}
- // Add the search results to the result
- $terms = MediaWikiServices::getInstance()->getContentLanguage()->
- convertForSearchResult( $matches->termMatches() );
$titles = [];
$count = 0;
}
if ( $resultPageSet === null ) {
- $vals = $this->getSearchResultData( $result, $prop, $terms );
+ $vals = $this->getSearchResultData( $result, $prop );
if ( $vals ) {
// Add item to results and see whether it fits
$fit = $apiResult->addValue( [ 'query', $this->getModuleName() ], null, $vals );
// Interwiki results inside main result set
$canAddInterwiki = (bool)$params['enablerewrites'] && ( $resultPageSet === null );
if ( $canAddInterwiki ) {
- $this->addInterwikiResults( $matches, $apiResult, $prop, $terms, 'additional',
- SearchResultSet::INLINE_RESULTS );
+ $this->addInterwikiResults( $matches, $apiResult, $prop, 'additional',
+ ISearchResultSet::INLINE_RESULTS );
}
// Interwiki results outside main result set
if ( $interwiki && $resultPageSet === null ) {
- $this->addInterwikiResults( $matches, $apiResult, $prop, $terms, 'interwiki',
- SearchResultSet::SECONDARY_RESULTS );
+ $this->addInterwikiResults( $matches, $apiResult, $prop, 'interwiki',
+ ISearchResultSet::SECONDARY_RESULTS );
}
if ( $resultPageSet === null ) {
* Assemble search result data.
* @param SearchResult $result Search result
* @param array $prop Props to extract (as keys)
- * @param array $terms Terms list
* @return array|null Result data or null if result is broken in some way.
*/
- private function getSearchResultData( SearchResult $result, $prop, $terms ) {
+ private function getSearchResultData( SearchResult $result, $prop ) {
// Silently skip broken and missing titles
if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {
return null;
$vals['wordcount'] = $result->getWordCount();
}
if ( isset( $prop['snippet'] ) ) {
- $vals['snippet'] = $result->getTextSnippet( $terms );
+ $vals['snippet'] = $result->getTextSnippet();
}
if ( isset( $prop['timestamp'] ) ) {
$vals['timestamp'] = wfTimestamp( TS_ISO_8601, $result->getTimestamp() );
/**
* Add interwiki results as a section in query results.
- * @param SearchResultSet $matches
+ * @param ISearchResultSet $matches
* @param ApiResult $apiResult
* @param array $prop Props to extract (as keys)
- * @param array $terms Terms list
* @param string $section Section name where results would go
* @param int $type Interwiki result type
* @return int|null Number of total hits in the data or null if none was produced
*/
private function addInterwikiResults(
- SearchResultSet $matches, ApiResult $apiResult, $prop,
- $terms, $section, $type
+ ISearchResultSet $matches, ApiResult $apiResult, $prop,
+ $section, $type
) {
$totalhits = null;
if ( $matches->hasInterwikiResults( $type ) ) {
foreach ( $interwikiMatches as $result ) {
$title = $result->getTitle();
- $vals = $this->getSearchResultData( $result, $prop, $terms );
+ $vals = $this->getSearchResultData( $result, $prop );
$vals['namespace'] = $result->getInterwikiNamespaceText();
$vals['title'] = $title->getText();