specialPage = $specialPage; $this->resultWidget = $resultWidget; $this->sidebarWidget = $sidebarWidget; } /** * @param string $term The search term to highlight * @param int $offset The offset of the first result in the result set * @param ISearchResultSet|null $titleResultSet Results of searching only page titles * @param ISearchResultSet|null $textResultSet Results of general full text search. * @return string HTML */ public function render( $term, $offset, ISearchResultSet $titleResultSet = null, ISearchResultSet $textResultSet = null ) { $hasTitle = $titleResultSet ? $titleResultSet->numRows() > 0 : false; $hasText = $textResultSet ? $textResultSet->numRows() > 0 : false; $hasSecondary = $textResultSet ? $textResultSet->hasInterwikiResults( ISearchResultSet::SECONDARY_RESULTS ) : false; $hasSecondaryInline = $textResultSet ? $textResultSet->hasInterwikiResults( ISearchResultSet::INLINE_RESULTS ) : false; if ( !$hasTitle && !$hasText && !$hasSecondary && !$hasSecondaryInline ) { return ''; } $out = ''; if ( $hasTitle ) { $out .= $this->header( $this->specialPage->msg( 'titlematches' ) ) . $this->renderResultSet( $titleResultSet, $offset ); } if ( $hasText ) { if ( $hasTitle ) { $out .= "
" . $this->header( $this->specialPage->msg( 'textmatches' ) ); } $out .= $this->renderResultSet( $textResultSet, $offset ); } if ( $hasSecondaryInline ) { $iwResults = $textResultSet->getInterwikiResults( ISearchResultSet::INLINE_RESULTS ); foreach ( $iwResults as $interwiki => $results ) { if ( $results instanceof Status || $results->numRows() === 0 ) { // ignore bad interwikis for now continue; } $out .= "