merged master (2012-09-11)
[lhc/web/wiklou.git] / includes / search / SearchEngine.php
index 2ccb6d3..c17f8c2 100644 (file)
@@ -804,11 +804,13 @@ class SearchResult {
         */
        protected function initText() {
                if ( !isset( $this->mText ) ) {
-                       if ( $this->mRevision != null )
-                               $this->mText = $this->mRevision->getText();
-                       else // TODO: can we fetch raw wikitext for commons images?
+                       if ( $this->mRevision != null ) {
+                               //TODO: don't use the text, but the content object!
+                               $content = $this->mRevision->getContent();
+                               $this->mText = $content->getTextForSearchIndex();
+                       } else { // TODO: can we fetch raw wikitext for commons images?
                                $this->mText = '';
-
+                       }
                }
        }
 
@@ -819,6 +821,8 @@ class SearchResult {
        function getTextSnippet( $terms ) {
                global $wgUser, $wgAdvancedSearchHighlighting;
                $this->initText();
+
+               // TODO: make highliter take a content object. Make ContentHandler a factory for SearchHighliter.
                list( $contextlines, $contextchars ) = SearchEngine::userHighlightPrefs( $wgUser );
                $h = new SearchHighlighter();
                if ( $wgAdvancedSearchHighlighting )