Merge "ProfilerOutputStats: allow a key prefix to be specified"
[lhc/web/wiklou.git] / includes / search / SearchResultSet.php
index f430dd0..0a05eef 100644 (file)
  * @ingroup Search
  */
 class SearchResultSet {
+       protected $containedSyntax = false;
+
+       public function __construct( $containedSyntax = false ) {
+               $this->containedSyntax = $containedSyntax;
+       }
+
        /**
         * Fetch an array of regular expression fragments for matching
         * the search terms as parsed by this engine in a text extract.
@@ -120,7 +126,7 @@ class SearchResultSet {
         * @return bool
         */
        public function searchContainedSyntax() {
-               return false;
+               return $this->containedSyntax;
        }
 }
 
@@ -161,7 +167,9 @@ class SqlSearchResultSet extends SearchResultSet {
                        return false;
                }
 
-               return SearchResult::newFromRow( $row );
+               return SearchResult::newFromTitle(
+                       Title::makeTitle( $row->page_namespace, $row->page_title )
+               );
        }
 
        function free() {
@@ -173,7 +181,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();
+               }
        }
 }