MediaWiki  master
SearchUpdate Class Reference

Database independent search index updater. More...

Inheritance diagram for SearchUpdate:
Collaboration diagram for SearchUpdate:

Public Member Functions

 __construct ( $id, $page, $c=null)
 
 doUpdate ()
 Perform actual update for the entry. More...
 
 updateText ( $text, SearchEngine $se=null)
 Clean text for indexing. More...
 

Private Member Functions

 getLatestPage ()
 Get ExistingPageRecord for the SearchUpdate $id using PageStore::READ_LATEST and ensure using the same ExistingPageRecord object if there are multiple SearchEngine types. More...
 
 getNormalizedTitle (SearchEngine $search)
 Get a normalized string representation of a title suitable for including in a search index. More...
 

Private Attributes

Content null $content
 Content of the page (not text) More...
 
int $id = 0
 Page id being updated. More...
 
ExistingPageRecord null $latestPage = null
 
PageIdentity $page
 The page we're updating. More...
 

Detailed Description

Database independent search index updater.

Definition at line 36 of file SearchUpdate.php.

Constructor & Destructor Documentation

◆ __construct()

SearchUpdate::__construct (   $id,
  $page,
  $c = null 
)
Parameters
int$idPage id to update
PageIdentity$pagePage to update
Content | null$cContent of the page to update.

Definition at line 54 of file SearchUpdate.php.

References $id, $page, and wfDeprecated().

Member Function Documentation

◆ doUpdate()

SearchUpdate::doUpdate ( )

Perform actual update for the entry.

Implements DeferrableUpdate.

Definition at line 72 of file SearchUpdate.php.

References $type, getLatestPage(), getNormalizedTitle(), and updateText().

◆ getLatestPage()

SearchUpdate::getLatestPage ( )
private

Get ExistingPageRecord for the SearchUpdate $id using PageStore::READ_LATEST and ensure using the same ExistingPageRecord object if there are multiple SearchEngine types.

Returns null if a page has been deleted or is not found.

Returns
ExistingPageRecord|null

Definition at line 182 of file SearchUpdate.php.

References $latestPage.

Referenced by doUpdate().

◆ getNormalizedTitle()

SearchUpdate::getNormalizedTitle ( SearchEngine  $search)
private

Get a normalized string representation of a title suitable for including in a search index.

Parameters
SearchEngine$search
Returns
string A stripped-down title string ready for the search index

Definition at line 198 of file SearchUpdate.php.

References $t, $title, SearchEngine\legalSearchChars(), SearchEngine\normalizeText(), and NS_FILE.

Referenced by doUpdate().

◆ updateText()

SearchUpdate::updateText (   $text,
SearchEngine  $se = null 
)

Clean text for indexing.

Only really suitable for indexing in databases. If you're using a real search engine, you'll probably want to override this behavior and do something nicer with the original wikitext.

Parameters
string$text
SearchEngine | null$seSearch engine
Returns
string

Definition at line 113 of file SearchUpdate.php.

Referenced by doUpdate().

Member Data Documentation

◆ $content

Content null SearchUpdate::$content
private

Content of the page (not text)

Definition at line 44 of file SearchUpdate.php.

◆ $id

int SearchUpdate::$id = 0
private

Page id being updated.

Definition at line 38 of file SearchUpdate.php.

Referenced by __construct().

◆ $latestPage

ExistingPageRecord null SearchUpdate::$latestPage = null
private

Definition at line 47 of file SearchUpdate.php.

Referenced by getLatestPage().

◆ $page

PageIdentity SearchUpdate::$page
private

The page we're updating.

Definition at line 41 of file SearchUpdate.php.

Referenced by __construct().


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