SearchHighlighter Class Reference
[Search]

Highlight bits of wikitext. More...

List of all members.

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


Detailed Description

Highlight bits of wikitext.

Definition at line 709 of file SearchEngine.php.


Member Function Documentation

SearchHighlighter::caseCallback ( matches  ) 

Do manual case conversion for non-ascii chars.

Parameters:
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.

Parameters:
string $text
int $start
int $end
int $posStart (out) actual start position
int $posEnd (out) actual end position
Returns:
string

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.

Parameters:
string $text
array $terms
int $contextlines
int $contextchars
Returns:
string

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.

Parameters:
string $text
array $terms Terms to highlight (unescaped)
int $contextlines
int $contextchars
Returns:
string

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

Parameters:
array $matches

Definition at line 1125 of file SearchEngine.php.

References $ns, and $wgContLang.

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

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

Parameters:
string $text
int $point
int $offset to found index
Returns:
int nearest nonletter index, or beginning of utf8 char if none

Definition at line 1026 of file SearchEngine.php.

References $offset, $s, and $text.

Referenced by extract().

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

Search extracts for a pattern, and return snippets.

Parameters:
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
Access:
protected

Definition at line 1059 of file SearchEngine.php.

References $end, $offset, $out, and extract().

Referenced by highlightText().

SearchHighlighter::removeWiki ( text  ) 

Basic wikitext removal.

Access:
protected

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.

Parameters:
array $extracts index -> $line
int $count
string $text

Definition at line 965 of file SearchEngine.php.

References $count, $text, and removeWiki().

Referenced by highlightText().


Member Data Documentation

SearchHighlighter::$mCleanWikitext = true

Definition at line 710 of file SearchEngine.php.


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

Generated on Sat Sep 5 02:08:46 2009 for MediaWiki by  doxygen 1.5.9