rm $wgCountTotalSearchHits. It was broken.
[lhc/web/wiklou.git] / includes / search / SearchResultSet.php
index f753e3d..698f93c 100644 (file)
@@ -40,16 +40,6 @@ class SearchResultSet {
                return 0;
        }
 
-       /**
-        * Return true if results are included in this result set.
-        * STUB
-        *
-        * @return bool
-        */
-       function hasResults() {
-               return false;
-       }
-
        /**
         * Some search modes return a total hit count for the query
         * in the entire article database. This may include pages
@@ -183,7 +173,12 @@ class SqlSearchResultSet extends SearchResultSet {
        }
 
        function getTotalHits() {
-               return $this->totalHits;
+               if ( !is_null( $this->totalHits ) ) {
+                       return $this->totalHits;
+               } else {
+                       // Special:Search expects a number here.
+                       return $this->numRows();
+               }
        }
 }
 
@@ -200,12 +195,8 @@ class SearchNearMatchResultSet extends SearchResultSet {
                $this->result = $match;
        }
 
-       public function hasResult() {
-               return (bool)$this->result;
-       }
-
        public function numRows() {
-               return $this->hasResults() ? 1 : 0;
+               return $this->result ? 1 : 0;
        }
 
        public function next() {