3 use Wikimedia\Rdbms\ResultWrapper
;
6 * This class is used for different SQL-based search engines shipped with MediaWiki
9 class SqlSearchResultSet
extends SearchResultSet
{
14 function __construct( ResultWrapper
$resultSet, $terms, $total = null ) {
15 $this->resultSet
= $resultSet;
16 $this->terms
= $terms;
17 $this->totalHits
= $total;
20 function termMatches() {
25 if ( $this->resultSet
=== false ) {
29 return $this->resultSet
->numRows();
33 if ( $this->resultSet
=== false ) {
37 $row = $this->resultSet
->fetchObject();
38 if ( $row === false ) {
42 return SearchResult
::newFromTitle(
43 Title
::makeTitle( $row->page_namespace
, $row->page_title
), $this
48 if ( $this->resultSet
) {
49 $this->resultSet
->rewind();
54 if ( $this->resultSet
=== false ) {
58 $this->resultSet
->free();
61 function getTotalHits() {
62 if ( !is_null( $this->totalHits
) ) {
63 return $this->totalHits
;
65 // Special:Search expects a number here.
66 return $this->numRows();