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


Member Function Documentation

SearchHighlighter::caseCallback ( matches  ) 

Do manual case conversion for non-ascii chars.

Parameters:
$matches Array

Definition at line 1022 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:
$text String
$start Integer
$end Integer
$posStart Integer: (out) actual start position
$posEnd Integer: (out) actual end position
Returns:
String

Definition at line 1040 of file SearchEngine.php.

References $wgContLang, and position().

Referenced by highlightText(), and process().

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

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

Parameters:
$text String
$terms Array
$contextlines Integer
$contextchars Integer
Returns:
String

Definition at line 1192 of file SearchEngine.php.

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

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

Default implementation of wikitext highlighting.

Parameters:
$text String
$terms Array: terms to highlight (unescaped)
$contextlines Integer
$contextchars Integer
Returns:
String

Definition at line 768 of file SearchEngine.php.

References $fname, $processed, $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:
$matches Array

Definition at line 1168 of file SearchEngine.php.

References $wgContLang.

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

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

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

Definition at line 1069 of file SearchEngine.php.

References $s.

Referenced by extract().

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

Search extracts for a pattern, and return snippets.

Parameters:
$pattern String: regexp for matching lines
$extracts Array: extracts to search
$linesleft Integer: number of extracts to make
$contextchars Integer: length of snippet
$out Array: map for highlighted snippets
$offsets Array: map of starting points of snippets
Access:
protected

Definition at line 1102 of file SearchEngine.php.

References $out, and extract().

Referenced by highlightText().

SearchHighlighter::removeWiki ( text  ) 

Basic wikitext removal.

Access:
protected

Definition at line 1138 of file SearchEngine.php.

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

Referenced by splitAndAdd().

SearchHighlighter::SearchHighlighter ( cleanupWikitext = true  ) 

Definition at line 755 of file SearchEngine.php.

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

Split text into lines and add it to extracts array.

Parameters:
$extracts Array: index -> $line
$count Integer
$text String

Definition at line 1008 of file SearchEngine.php.

References removeWiki().

Referenced by highlightText().


Member Data Documentation

SearchHighlighter::$mCleanWikitext = true

Definition at line 753 of file SearchEngine.php.


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

Generated on Sat Apr 30 22:57:48 2011 for MediaWiki by  doxygen 1.5.9