MediaWiki  REL1_23
SearchResult Class Reference
Inheritance diagram for SearchResult:
Collaboration diagram for SearchResult:

List of all members.

Public Member Functions

 __construct ($row=null)
 getByteSize ()
 getFile ()
 Get the file for this page, if one exists.
 getInterwikiNamespaceText ()
 getInterwikiPrefix ()
 getRedirectSnippet ()
 getRedirectTitle ()
 getScore ()
 getSectionSnippet ()
 getSectionTitle ()
 getTextSnippet ($terms)
 getTimestamp ()
 getTitle ()
 getTitleSnippet ()
 getWordCount ()
 hasRelated ()
 isBrokenTitle ()
 Check if this is result points to an invalid title.
 isFileMatch ()
 Did this match file contents (eg: PDF/DJVU)?
 isMissingRevision ()
 Check if target page is missing, happens when index is out of date.

Static Public Member Functions

static newFromRow ($row)
 Return a new SearchResult and initializes it with a row.
static newFromTitle ($title)
 Return a new SearchResult and initializes it with a title.

Protected Member Functions

 initFromRow ($row)
 Initialize from a database row.
 initFromTitle ($title)
 Initialize from a Title and if possible initializes a corresponding Revision and File.
 initText ()
 Lazy initialization of article text from DB.

Protected Attributes

File $mImage = null
Revision $mRevision = null
String $mText
Title $mTitle

Detailed Description

Todo:
FIXME: This class is horribly factored.

It would probably be better to have a useful base class to which you pass some standard information, then let the fancy self-highlighters extend that.

Definition at line 30 of file SearchResult.php.


Constructor & Destructor Documentation

SearchResult::__construct ( row = null)

Reimplemented in PostgresSearchResult.

Definition at line 72 of file SearchResult.php.


Member Function Documentation

Returns:
Integer: size in bytes

Definition at line 238 of file SearchResult.php.

References initText().

Get the file for this page, if one exists.

Returns:
File|null

Definition at line 137 of file SearchResult.php.

Returns:
string interwiki namespace of the title (since we likely can't resolve it locally)

Definition at line 260 of file SearchResult.php.

Returns:
String: interwiki prefix of the title (return iw even if title is broken)

Definition at line 253 of file SearchResult.php.

Returns:
String: highlighted redirect name (redirect to this page), '' if none or not supported

Definition at line 190 of file SearchResult.php.

Returns:
Title object for the redirect to this page, null if none or not supported

Definition at line 197 of file SearchResult.php.

Returns:
float|null if not supported

Reimplemented in PostgresSearchResult.

Definition at line 144 of file SearchResult.php.

Returns:
string highlighted relevant section name, null if none or not supported

Definition at line 204 of file SearchResult.php.

Returns:
Title object (pagename+fragment) for the section, null if none or not supported

Definition at line 211 of file SearchResult.php.

Parameters:
array$termsterms to highlight
Returns:
String: highlighted text snippet, null (and not '') if not supported

Definition at line 166 of file SearchResult.php.

Returns:
String: timestamp

Definition at line 218 of file SearchResult.php.

Returns:
Title

Definition at line 129 of file SearchResult.php.

Returns:
String: highlighted title, '' if not supported

Definition at line 183 of file SearchResult.php.

Returns:
Integer: number of words

Definition at line 230 of file SearchResult.php.

References initText().

Returns:
Boolean if hit has related articles

Definition at line 246 of file SearchResult.php.

SearchResult::initFromRow ( row) [protected]

Initialize from a database row.

Makes a Title and passes that to initFromTitle.

Parameters:
$rowobject

Definition at line 85 of file SearchResult.php.

SearchResult::initFromTitle ( title) [protected]

Initialize from a Title and if possible initializes a corresponding Revision and File.

Parameters:
$titleTitle

Definition at line 95 of file SearchResult.php.

SearchResult::initText ( ) [protected]

Lazy initialization of article text from DB.

Definition at line 151 of file SearchResult.php.

References SearchEngine\create().

Referenced by getByteSize(), and getWordCount().

Check if this is result points to an invalid title.

Returns:
Boolean

Definition at line 113 of file SearchResult.php.

Did this match file contents (eg: PDF/DJVU)?

Definition at line 267 of file SearchResult.php.

Check if target page is missing, happens when index is out of date.

Returns:
Boolean

Definition at line 122 of file SearchResult.php.

static SearchResult::newFromRow ( row) [static]

Return a new SearchResult and initializes it with a row.

Parameters:
$rowobject
Returns:
SearchResult

Definition at line 66 of file SearchResult.php.

Referenced by SqlSearchResultSet\next().

static SearchResult::newFromTitle ( title) [static]

Return a new SearchResult and initializes it with a title.

Parameters:
$titleTitle
Returns:
SearchResult

Definition at line 54 of file SearchResult.php.

Referenced by SearchNearMatchResultSet\next().


Member Data Documentation

File SearchResult::$mImage = null [protected]

Definition at line 38 of file SearchResult.php.

Revision SearchResult::$mRevision = null [protected]

Definition at line 34 of file SearchResult.php.

String SearchResult::$mText [protected]

Definition at line 46 of file SearchResult.php.

Title SearchResult::$mTitle [protected]

Definition at line 42 of file SearchResult.php.


The documentation for this class was generated from the following file: