Add sslCAFile option to DatabaseMysqli
[mediawiki.git] / includes / search / SqlSearchResultSet.php
blob53d09e82b1017858c42df0b2d1d4679fdeed77bf
1 <?php
3 use Wikimedia\Rdbms\ResultWrapper;
5 /**
6 * This class is used for different SQL-based search engines shipped with MediaWiki
7 * @ingroup Search
8 */
9 class SqlSearchResultSet extends SearchResultSet {
10 protected $resultSet;
11 protected $terms;
12 protected $totalHits;
14 function __construct( ResultWrapper $resultSet, $terms, $total = null ) {
15 $this->resultSet = $resultSet;
16 $this->terms = $terms;
17 $this->totalHits = $total;
20 function termMatches() {
21 return $this->terms;
24 function numRows() {
25 if ( $this->resultSet === false ) {
26 return false;
29 return $this->resultSet->numRows();
32 function next() {
33 if ( $this->resultSet === false ) {
34 return false;
37 $row = $this->resultSet->fetchObject();
38 if ( $row === false ) {
39 return false;
42 return SearchResult::newFromTitle(
43 Title::makeTitle( $row->page_namespace, $row->page_title ), $this
47 function rewind() {
48 if ( $this->resultSet ) {
49 $this->resultSet->rewind();
53 function free() {
54 if ( $this->resultSet === false ) {
55 return false;
58 $this->resultSet->free();
61 function getTotalHits() {
62 if ( !is_null( $this->totalHits ) ) {
63 return $this->totalHits;
64 } else {
65 // Special:Search expects a number here.
66 return $this->numRows();