Merge "Handle missing namespace prefix in XML dumps more gracefully"
[lhc/web/wiklou.git] / includes / search / SqlSearchResultSet.php
index 7a6aaf7..53d09e8 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * This class is used for different SQL-based search engines shipped with MediaWiki
  * @ingroup Search
@@ -8,7 +11,7 @@ class SqlSearchResultSet extends SearchResultSet {
        protected $terms;
        protected $totalHits;
 
-       function __construct( $resultSet, $terms, $total = null ) {
+       function __construct( ResultWrapper $resultSet, $terms, $total = null ) {
                $this->resultSet = $resultSet;
                $this->terms = $terms;
                $this->totalHits = $total;
@@ -37,10 +40,16 @@ class SqlSearchResultSet extends SearchResultSet {
                }
 
                return SearchResult::newFromTitle(
-                       Title::makeTitle( $row->page_namespace, $row->page_title )
+                       Title::makeTitle( $row->page_namespace, $row->page_title ), $this
                );
        }
 
+       function rewind() {
+               if ( $this->resultSet ) {
+                       $this->resultSet->rewind();
+               }
+       }
+
        function free() {
                if ( $this->resultSet === false ) {
                        return false;