- // Get number of results
- $titleMatchesNum = $titleMatches ? $titleMatches->numRows() : 0;
- $textMatchesNum = $textMatches ? $textMatches->numRows() : 0;
- // Total initial query matches (possible false positives)
- $num = $titleMatchesNum + $textMatchesNum;
-
- // Get total actual results (after second filtering, if any)
- $numTitleMatches = $titleMatches && !is_null( $titleMatches->getTotalHits() ) ?
- $titleMatches->getTotalHits() : $titleMatchesNum;
- $numTextMatches = $textMatches && !is_null( $textMatches->getTotalHits() ) ?
- $textMatches->getTotalHits() : $textMatchesNum;
-
- // get total number of results if backend can calculate it
- $totalRes = 0;
- if($titleMatches && !is_null( $titleMatches->getTotalHits() ) )
- $totalRes += $titleMatches->getTotalHits();
- if($textMatches && !is_null( $textMatches->getTotalHits() ))
- $totalRes += $textMatches->getTotalHits();
-
- // show number of results and current offset
- $wgOut->addHTML( $this->formHeader($term, $num, $totalRes));
- if( $this->searchAdvanced ) {
- $wgOut->addHTML( $this->powerSearchBox( $term ) );
- }
-
- $wgOut->addHtml( Xml::closeElement( 'form' ) );
- $wgOut->addHtml( "<div class='searchresults'>" );
-
- // prev/next links
- if( $num || $this->offset ) {
- // Show the create link ahead
- $this->showCreateLink( $t );
- $prevnext = wfViewPrevNext( $this->offset, $this->limit,
- SpecialPage::getTitleFor( 'Search' ),
- wfArrayToCGI( $this->powerSearchOptions(), array( 'search' => $term ) ),
- max( $titleMatchesNum, $textMatchesNum ) < $this->limit
- );
- //$wgOut->addHTML( "<p class='mw-search-pager-top'>{$prevnext}</p>\n" );
- wfRunHooks( 'SpecialSearchResults', array( $term, &$titleMatches, &$textMatches ) );
- } else {
- wfRunHooks( 'SpecialSearchNoResults', array( $term ) );
- }
-
- if( $titleMatches ) {
- if( $numTitleMatches > 0 ) {
- $wgOut->wrapWikiMsg( "==$1==\n", 'titlematches' );
- $wgOut->addHTML( $this->showMatches( $titleMatches ) );
- }
- $titleMatches->free();
- }
- if( $textMatches ) {
- // output appropriate heading
- if( $numTextMatches > 0 && $numTitleMatches > 0 ) {
- // if no title matches the heading is redundant
- $wgOut->wrapWikiMsg( "==$1==\n", 'textmatches' );
- } elseif( $totalRes == 0 ) {
- # Don't show the 'no text matches' if we received title matches
- # $wgOut->wrapWikiMsg( "==$1==\n", 'notextmatches' );
- }
- // show interwiki results if any
- if( $textMatches->hasInterwikiResults() ) {
- $wgOut->addHTML( $this->showInterwiki( $textMatches->getInterwikiResults(), $term ) );