Merge "API: Warn about POST without Content-Type"
[lhc/web/wiklou.git] / includes / search / SearchResult.php
index 1d71c87..1954e85 100644 (file)
@@ -51,11 +51,6 @@ class SearchResult {
         */
        protected $mText;
 
-       /**
-        * @var SearchEngine
-        */
-       protected $searchEngine;
-
        /**
         * A function returning a set of extension data.
         * @var Closure|null
@@ -96,7 +91,6 @@ class SearchResult {
                                $this->mImage = $services->getRepoGroup()->findFile( $this->mTitle );
                        }
                }
-               $this->searchEngine = $services->newSearchEngine();
        }
 
        /**
@@ -138,8 +132,8 @@ class SearchResult {
        protected function initText() {
                if ( !isset( $this->mText ) ) {
                        if ( $this->mRevision != null ) {
-                               $this->mText = $this->searchEngine->getTextFromContent(
-                                               $this->mTitle, $this->mRevision->getContent() );
+                               $content = $this->mRevision->getContent();
+                               $this->mText = $content !== null ? $content->getTextForSearchIndex() : '';
                        } else { // TODO: can we fetch raw wikitext for commons images?
                                $this->mText = '';
                        }