MediaWiki  REL1_22
SearchHighlighter Class Reference

Highlight bits of wikitext. More...

List of all members.

Public Member Functions

 __construct ($cleanupWikitext=true)
 caseCallback ($matches)
 Do manual case conversion for non-ascii chars.
 extract ($text, $start, $end, &$posStart=null, &$posEnd=null)
 Extract part of the text from start to end, but by not chopping up words.
 highlightSimple ($text, $terms, $contextlines, $contextchars)
 Simple & fast snippet extraction, but gives completely unrelevant snippets.
 highlightText ($text, $terms, $contextlines, $contextchars)
 Default implementation of wikitext highlighting.
 linkReplace ($matches)
 callback to replace [[target|caption]] kind of links, if the target is category or image, leave it
 position ($text, $point, $offset=0)
 Find a nonletter near a point (index) in the text.
 process ($pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets)
 Search extracts for a pattern, and return snippets.
 removeWiki ($text)
 Basic wikitext removal.
 splitAndAdd (&$extracts, &$count, $text)
 Split text into lines and add it to extracts array.

Public Attributes

 $mCleanWikitext = true

Detailed Description

Highlight bits of wikitext.

Definition at line 999 of file SearchEngine.php.


Constructor & Destructor Documentation

SearchHighlighter::__construct ( cleanupWikitext = true)

Definition at line 1002 of file SearchEngine.php.


Member Function Documentation

Do manual case conversion for non-ascii chars.

Parameters:
$matchesArray
Returns:
string

Definition at line 1277 of file SearchEngine.php.

SearchHighlighter::extract ( text,
start,
end,
&$  posStart = null,
&$  posEnd = null 
)

Extract part of the text from start to end, but by not chopping up words.

Parameters:
$textString
$startInteger
$endInteger
$posStartInteger: (out) actual start position
$posEndInteger: (out) actual end position
Returns:
String

Definition at line 1296 of file SearchEngine.php.

SearchHighlighter::highlightSimple ( text,
terms,
contextlines,
contextchars 
)

Simple & fast snippet extraction, but gives completely unrelevant snippets.

Parameters:
$textString
$termsArray
$contextlinesInteger
$contextcharsInteger
Returns:
String

Definition at line 1459 of file SearchEngine.php.

SearchHighlighter::highlightText ( text,
terms,
contextlines,
contextchars 
)

Default implementation of wikitext highlighting.

Parameters:
$textString
array$termsterms to highlight (unescaped)
$contextlinesInteger
$contextcharsInteger
Returns:
String

Definition at line 1015 of file SearchEngine.php.

callback to replace [[target|caption]] kind of links, if the target is category or image, leave it

Parameters:
$matchesArray

Definition at line 1434 of file SearchEngine.php.

SearchHighlighter::position ( text,
point,
offset = 0 
)

Find a nonletter near a point (index) in the text.

Parameters:
$textString
$pointInteger
$offsetInteger: offset to found index
Returns:
Integer: nearest nonletter index, or beginning of utf8 char if none

Definition at line 1328 of file SearchEngine.php.

SearchHighlighter::process ( pattern,
extracts,
&$  linesleft,
&$  contextchars,
&$  out,
&$  offsets 
)

Search extracts for a pattern, and return snippets.

Parameters:
string$patternregexp for matching lines
array$extractsextracts to search
$linesleftInteger: number of extracts to make
$contextcharsInteger: length of snippet
array$outmap for highlighted snippets
array$offsetsmap of starting points of snippets
Access:
protected

Definition at line 1362 of file SearchEngine.php.

Basic wikitext removal.

Access:
protected
Returns:
mixed

Definition at line 1404 of file SearchEngine.php.

SearchHighlighter::splitAndAdd ( &$  extracts,
&$  count,
text 
)

Split text into lines and add it to extracts array.

Parameters:
array$extractsindex -> $line
$countInteger
$textString

Definition at line 1261 of file SearchEngine.php.


Member Data Documentation

SearchHighlighter::$mCleanWikitext = true

Definition at line 1000 of file SearchEngine.php.


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