MediaWiki REL1_32
SearchUpdate Class Reference

Database independant search index updater. More...

Inheritance diagram for SearchUpdate:
Collaboration diagram for SearchUpdate:

Public Member Functions

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

Private Member Functions

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

Private Attributes

Content bool $content
 Content of the page (not text)
 
int $id = 0
 Page id being updated.
 
WikiPage $page
 
Title $title
 Title we're updating.
 

Detailed Description

Database independant search index updater.

Definition at line 33 of file SearchUpdate.php.

Constructor & Destructor Documentation

◆ __construct()

SearchUpdate::__construct (   $id,
  $title,
  $c = false 
)
Parameters
int$idPage id to update
Title | string$titleTitle of page to update
Content | string | bool$cContent of the page to update. Default: false. If a Content object, text will be gotten from it. String is for back-compat. Passing false tells the backend to just update the title, not the content

Definition at line 53 of file SearchUpdate.php.

References $title, content, title, and wfDebug().

Member Function Documentation

◆ doUpdate()

SearchUpdate::doUpdate ( )

Perform actual update for the entry.

Implements DeferrableUpdate.

Definition at line 77 of file SearchUpdate.php.

References $services, $type, as, content, getLatestPage(), getNormalizedTitle(), title, and updateText().

◆ getLatestPage()

SearchUpdate::getLatestPage ( )
private

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

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

Returns
WikiPage|null

Definition at line 189 of file SearchUpdate.php.

References page.

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 204 of file SearchUpdate.php.

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

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 120 of file SearchUpdate.php.

References $services.

Referenced by doUpdate().

Member Data Documentation

◆ $content

Content bool SearchUpdate::$content
private

Content of the page (not text)

Definition at line 41 of file SearchUpdate.php.

◆ $id

int SearchUpdate::$id = 0
private

Page id being updated.

Definition at line 35 of file SearchUpdate.php.

◆ $page

WikiPage SearchUpdate::$page
private

Definition at line 44 of file SearchUpdate.php.

◆ $title

Title SearchUpdate::$title
private

Title we're updating.

Definition at line 38 of file SearchUpdate.php.


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