3 * This class is used for different SQL-based search engines shipped with MediaWiki
6 class SqlSearchResultSet
extends SearchResultSet
{
11 function __construct( $resultSet, $terms, $total = null ) {
12 $this->resultSet
= $resultSet;
13 $this->terms
= $terms;
14 $this->totalHits
= $total;
17 function termMatches() {
22 if ( $this->resultSet
=== false ) {
26 return $this->resultSet
->numRows();
30 if ( $this->resultSet
=== false ) {
34 $row = $this->resultSet
->fetchObject();
35 if ( $row === false ) {
39 return SearchResult
::newFromTitle(
40 Title
::makeTitle( $row->page_namespace
, $row->page_title
)
45 if ( $this->resultSet
=== false ) {
49 $this->resultSet
->free();
52 function getTotalHits() {
53 if ( !is_null( $this->totalHits
) ) {
54 return $this->totalHits
;
56 // Special:Search expects a number here.
57 return $this->numRows();