22 protected $mRevisionRecord =
null;
46 $this->mTitle = $title;
47 if ( $title !==
null ) {
48 $services = MediaWikiServices::getInstance();
50 (
new HookRunner( $services->getHookContainer() ) )->onSearchResultInitFromTitle( $title, $id );
52 $this->mRevisionRecord = $services->getRevisionLookup()->getRevisionByTitle(
55 IDBAccessObject::READ_NORMAL
57 if ( $title->getNamespace() ===
NS_FILE ) {
58 $this->mImage = $services->getRepoGroup()->findFile( $title );
69 return $this->mTitle ===
null;
100 if ( $this->mText ===
null ) {
101 if ( $this->mRevisionRecord !=
null ) {
102 $content = $this->mRevisionRecord->getContent( SlotRecord::MAIN );
103 $this->mText = $content !==
null ? $content->getTextForSearchIndex() :
'';
200 if ( $this->mRevisionRecord ) {
202 } elseif ( $this->mImage ) {
203 return $this->mImage->getTimestamp();
213 return str_word_count( $this->mText );
221 return strlen( $this->mText );
isMissingRevision()
Check if target page is missing, happens when index is out of date.
getInterwikiNamespaceText()
getTextSnippet( $terms=[])
getCategorySnippetField()
initFromTitle( $title)
Initialize from a Title and if possible initializes a corresponding RevisionRecord and File.
getRedirectSnippetField()
isFileMatch()
Did this match file contents (eg: PDF/DJVU)?
isBrokenTitle()
Check if this is result points to an invalid title.
trait RevisionSearchResultTrait
Transitional trait used to share the methods between SearchResult and RevisionSearchResult.
getFile()
Get the file for this page, if one exists.
initText()
Lazy initialization of article text from DB.