Public Member Functions | |
SearchHighlighter ($cleanupWikitext=true) | |
highlightText ($text, $terms, $contextlines, $contextchars) | |
Default implementation of wikitext highlighting. | |
splitAndAdd (&$extracts, &$count, $text) | |
Split text into lines and add it to extracts array. | |
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. | |
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. | |
linkReplace ($matches) | |
callback to replace [[target|caption]] kind of links, if the target is category or image, leave it | |
highlightSimple ($text, $terms, $contextlines, $contextchars) | |
Simple & fast snippet extraction, but gives completely unrelevant snippets. | |
Public Attributes | |
$mCleanWikitext = true |
Definition at line 709 of file SearchEngine.php.
SearchHighlighter::caseCallback | ( | $ | matches | ) |
Do manual case conversion for non-ascii chars.
unknown_type | $matches |
Definition at line 979 of file SearchEngine.php.
References $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.
string | $text | |
int | $start | |
int | $end | |
int | $posStart (out) actual start position | |
int | $posEnd (out) actual end position |
Definition at line 997 of file SearchEngine.php.
References $end, $start, $text, $wgContLang, and position().
Referenced by highlightText(), and process().
SearchHighlighter::highlightSimple | ( | $ | text, | |
$ | terms, | |||
$ | contextlines, | |||
$ | contextchars | |||
) |
Simple & fast snippet extraction, but gives completely unrelevant snippets.
string | $text | |
array | $terms | |
int | $contextlines | |
int | $contextchars |
Definition at line 1149 of file SearchEngine.php.
References $fname, $text, $wgContLang, $wgLang, wfProfileIn(), and wfProfileOut().
SearchHighlighter::highlightText | ( | $ | text, | |
$ | terms, | |||
$ | contextlines, | |||
$ | contextchars | |||
) |
Default implementation of wikitext highlighting.
string | $text | |
array | $terms Terms to highlight (unescaped) | |
int | $contextlines | |
int | $contextchars |
Definition at line 725 of file SearchEngine.php.
References $count, $fname, $key, $ns, $offset, $start, $text, $wgContLang, $wgLang, $wgSearchHighlightBoundaries, extract(), process(), splitAndAdd(), wfProfileIn(), and wfProfileOut().
SearchHighlighter::linkReplace | ( | $ | matches | ) |
callback to replace [[target|caption]] kind of links, if the target is category or image, leave it
array | $matches |
Definition at line 1125 of file SearchEngine.php.
References $ns, and $wgContLang.
SearchHighlighter::position | ( | $ | text, | |
$ | point, | |||
$ | offset = 0 | |||
) |
SearchHighlighter::process | ( | $ | pattern, | |
$ | extracts, | |||
&$ | linesleft, | |||
&$ | contextchars, | |||
&$ | out, | |||
&$ | offsets | |||
) |
Search extracts for a pattern, and return snippets.
string | $pattern regexp for matching lines | |
array | $extracts extracts to search | |
int | $linesleft number of extracts to make | |
int | $contextchars length of snippet | |
array | $out map for highlighted snippets | |
array | $offsets map of starting points of snippets |
Definition at line 1059 of file SearchEngine.php.
References $end, $offset, $out, and extract().
Referenced by highlightText().
SearchHighlighter::removeWiki | ( | $ | text | ) |
Basic wikitext removal.
Definition at line 1095 of file SearchEngine.php.
References $fname, $text, wfProfileIn(), and wfProfileOut().
Referenced by splitAndAdd().
SearchHighlighter::SearchHighlighter | ( | $ | cleanupWikitext = true |
) |
Definition at line 712 of file SearchEngine.php.
SearchHighlighter::splitAndAdd | ( | &$ | extracts, | |
&$ | count, | |||
$ | text | |||
) |
Split text into lines and add it to extracts array.
array | $extracts index -> $line | |
int | $count | |
string | $text |
Definition at line 965 of file SearchEngine.php.
References $count, $text, and removeWiki().
Referenced by highlightText().
SearchHighlighter::$mCleanWikitext = true |
Definition at line 710 of file SearchEngine.php.