public function highlightExtended($words, $callback, $params = array())
    {
        /**
 * Zend_Search_Lucene_Analysis_Analyzer 
*/
        include_once 'Zend/Search/Lucene/Analysis/Analyzer.php';

        if (!is_array($words)) {
            $words = array($words);
        }

        $wordsToHighlightList = array();
        $analyzer = Zend_Search_Lucene_Analysis_Analyzer::getDefault();
        foreach ($words as $wordString) {
            $wordsToHighlightList[] = $analyzer->tokenize($wordString);
        }
        $wordsToHighlight = call_user_func_array('array_merge', $wordsToHighlightList);

        if (count($wordsToHighlight) == 0) {
            return $this->_doc->saveHTML();
        }

        $wordsToHighlightFlipped = array();
        foreach ($wordsToHighlight as $id => $token) {
            $wordsToHighlightFlipped[$token->getTermText()] = $id;
        }

        if (!is_callable($callback)) {
            include_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('$viewHelper parameter mast be a View Helper name, View Helper object or callback.');
        }

        $xpath = new DOMXPath($this->_doc);

        $matchedNodes = $xpath->query("/html/body");
        foreach ($matchedNodes as $matchedNode) {
            $this->_highlightNodeRecursive($matchedNode, $wordsToHighlightFlipped, $callback, $params);
        }
    }
public function highlightExtended($words, $callback, $params = array())
    {
        /**
 * Zend_Search_Lucene_Analysis_Analyzer 
*/
        include_once 'Zend/Search/Lucene/Analysis/Analyzer.php';

        if (!is_array($words)) {
            $words = array($words);
        }

        $wordsToHighlightList = array();
        $analyzer = Zend_Search_Lucene_Analysis_Analyzer::getDefault();
        foreach ($words as $wordString) {
            $wordsToHighlightList[] = $analyzer->tokenize($wordString);
        }
        $wordsToHighlight = call_user_func_array('array_merge', $wordsToHighlightList);

        if (count($wordsToHighlight) == 0) {
            return $this->_doc->saveHTML();
        }

        $wordsToHighlightFlipped = array();
        foreach ($wordsToHighlight as $id => $token) {
            $wordsToHighlightFlipped[$token->getTermText()] = $id;
        }

        if (!is_callable($callback)) {
            include_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('$viewHelper parameter mast be a View Helper name, View Helper object or callback.');
        }

        $xpath = new DOMXPath($this->_doc);

        $matchedNodes = $xpath->query("/html/body");
        foreach ($matchedNodes as $matchedNode) {
            $this->_highlightNodeRecursive($matchedNode, $wordsToHighlightFlipped, $callback, $params);
        }
    }
public function highlightExtended ( $ words , $ callback , $ params = array ( ) ) { /**
 * Zend_Search_Lucene_Analysis_Analyzer 
*/ include_once 'Zend/Search/Lucene/Analysis/Analyzer.php' ; if ( ! is_array ( $ words ) ) { $ words = array ( $ words ) ; } $ wordsToHighlightList = array ( ) ; $ analyzer = Zend_Search_Lucene_Analysis_Analyzer :: getDefault ( ) ; foreach ( $ words as $ wordString ) { $ wordsToHighlightList [ ] = $ analyzer -> tokenize ( $ wordString ) ; } $ wordsToHighlight = call_user_func_array ( 'array_merge' , $ wordsToHighlightList ) ; if ( count ( $ wordsToHighlight ) == 0 ) { return $ this -> _doc -> saveHTML ( ) ; } $ wordsToHighlightFlipped = array ( ) ; foreach ( $ wordsToHighlight as $ id => $ token ) { $ wordsToHighlightFlipped [ $ token -> getTermText ( ) ] = $ id ; } if ( ! is_callable ( $ callback ) ) { include_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( '$viewHelper parameter mast be a View Helper name, View Helper object or callback.' ) ; } $ xpath = new DOMXPath ( $ this -> _doc ) ; $ matchedNodes = $ xpath -> query ( "/html/body" ) ; foreach ( $ matchedNodes as $ matchedNode ) { $ this -> _highlightNodeRecursive ( $ matchedNode , $ wordsToHighlightFlipped , $ callback , $ params ) ; } }
Highlight text using specified View helper or callback function.

@param  string|array $words    Words to highlight. Words could be organized using the array or string.
@param  callback     $callback Callback method, used to transform (highlighting) text.
@param  array        $params   Array of additionall callback parameters passed through into it (first non-optional parameter is an HTML fragment for highlighting) (first non-optional parameter is an HTML fragment for highlighting)
(first non-optional parameter is an HTML fragment for highlighting)
@return string
@throws Zend_Search_Lucene_Exception
Highlight text using specified View helper or callback function .