From 4516752ab0ad7e2d08cd70ba746e5821ba493164 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 8 Jun 2012 09:05:30 +0200 Subject: [PATCH] use Content::getTextForSearchIndex() --- includes/search/SearchEngine.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 678c530583..ed51f75a6a 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -801,11 +801,12 @@ 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 ) { + $content = $this->mRevision->getContent(); + $this->mText = $content->getTextForSearchIndex(); //XXX: maybe we don't even need the text, but the content object? + } else { // TODO: can we fetch raw wikitext for commons images? $this->mText = ''; - + } } } @@ -817,7 +818,7 @@ class SearchResult { global $wgUser, $wgAdvancedSearchHighlighting; $this->initText(); list( $contextlines, $contextchars ) = SearchEngine::userHighlightPrefs( $wgUser ); - $h = new SearchHighlighter(); + $h = new SearchHighlighter(); // TODO: make highliter take a content object. Make ContentHandler a factory for SearchHighliter. if ( $wgAdvancedSearchHighlighting ) return $h->highlightText( $this->mText, $terms, $contextlines, $contextchars ); else -- 2.20.1