return $parsed;
}
- $allkeyword = wfMsgForContent( 'searchall' ) . ":";
+ $allkeyword = wfMessage( 'searchall' )->inContentLanguage()->text() . ":";
if ( strncmp( $query, $allkeyword, strlen( $allkeyword ) ) == 0 ) {
$this->namespaces = null;
$parsed = substr( $query, strlen( $allkeyword ) );
$formatted = array_map( array( $wgContLang, 'getFormattedNsText' ), $namespaces );
foreach ( $formatted as $key => $ns ) {
if ( empty( $ns ) )
- $formatted[$key] = wfMsg( 'blanknamespace' );
+ $formatted[$key] = wfMessage( 'blanknamespace' )->text();
}
return $formatted;
}
$this->mTitle = $title;
if ( !is_null( $this->mTitle ) ) {
$this->mRevision = Revision::newFromTitle(
- $this->mTitle, false, Revision::AVOID_MASTER );
+ $this->mTitle, false, Revision::READ_NORMAL );
if ( $this->mTitle->getNamespace() === NS_FILE )
$this->mImage = wfFindFile( $this->mTitle );
}
*/
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 = '';
-
+ }
}
}
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