Expose $wgMaxArticleSize in siteinfo query api
[mediawiki.git] / includes / search / SqlSearchResultSet.php
blob6b60899f10c65b053ba2af36228b6817efdf1d91
1 <?php
2 /**
3 * This class is used for different SQL-based search engines shipped with MediaWiki
4 * @ingroup Search
5 */
6 class SqlSearchResultSet extends SearchResultSet {
7 protected $resultSet;
8 protected $terms;
9 protected $totalHits;
11 function __construct( ResultWrapper $resultSet, $terms, $total = null ) {
12 $this->resultSet = $resultSet;
13 $this->terms = $terms;
14 $this->totalHits = $total;
17 function termMatches() {
18 return $this->terms;
21 function numRows() {
22 if ( $this->resultSet === false ) {
23 return false;
26 return $this->resultSet->numRows();
29 function next() {
30 if ( $this->resultSet === false ) {
31 return false;
34 $row = $this->resultSet->fetchObject();
35 if ( $row === false ) {
36 return false;
39 return SearchResult::newFromTitle(
40 Title::makeTitle( $row->page_namespace, $row->page_title )
44 function rewind() {
45 if ( $this->resultSet ) {
46 $this->resultSet->rewind();
50 function free() {
51 if ( $this->resultSet === false ) {
52 return false;
55 $this->resultSet->free();
58 function getTotalHits() {
59 if ( !is_null( $this->totalHits ) ) {
60 return $this->totalHits;
61 } else {
62 // Special:Search expects a number here.
63 return $this->numRows();