MediaWiki  REL1_19
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 917 of file SearchEngine.php.


Constructor & Destructor Documentation

SearchHighlighter::__construct ( cleanupWikitext = true)

Definition at line 920 of file SearchEngine.php.


Member Function Documentation

Do manual case conversion for non-ascii chars.

Parameters:
$matchesArray

Definition at line 1189 of file SearchEngine.php.

References $matches, and $wgContLang.

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 1208 of file SearchEngine.php.

References position().

Referenced by highlightText(), and process().

Here is the call graph for this function:

Here is the caller graph for this function:

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 1363 of file SearchEngine.php.

References $fname, $lines, $wgContLang, wfProfileIn(), and wfProfileOut().

Here is the call graph for this function:

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

Default implementation of wikitext highlighting.

Parameters:
$textString
$termsArray: terms to highlight (unescaped)
$contextlinesInteger
$contextcharsInteger
Returns:
String

Definition at line 933 of file SearchEngine.php.

References $count, $fname, $matches, $processed, $wgContLang, $wgSearchHighlightBoundaries, extract(), process(), splitAndAdd(), wfProfileIn(), and wfProfileOut().

Here is the call graph for this function:

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

Parameters:
$matchesArray

Definition at line 1339 of file SearchEngine.php.

References $matches, and $wgContLang.

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 1240 of file SearchEngine.php.

Referenced by extract().

Here is the caller graph for this function:

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

Search extracts for a pattern, and return snippets.

Parameters:
$patternString: regexp for matching lines
$extractsArray: extracts to search
$linesleftInteger: number of extracts to make
$contextcharsInteger: length of snippet
$outArray: map for highlighted snippets
$offsetsArray: map of starting points of snippets
Access:
protected

Definition at line 1273 of file SearchEngine.php.

References $out, and extract().

Referenced by highlightText().

Here is the call graph for this function:

Here is the caller graph for this function:

Basic wikitext removal.

Access:
protected

Definition at line 1309 of file SearchEngine.php.

References $fname, wfProfileIn(), and wfProfileOut().

Referenced by splitAndAdd().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Split text into lines and add it to extracts array.

Parameters:
$extractsArray: index -> $line
$countInteger
$textString

Definition at line 1175 of file SearchEngine.php.

References $count, and removeWiki().

Referenced by highlightText().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

SearchHighlighter::$mCleanWikitext = true

Definition at line 918 of file SearchEngine.php.


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