當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Search_Lucene_Document_Html::highlight方法代碼示例

本文整理匯總了PHP中Zend_Search_Lucene_Document_Html::highlight方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Search_Lucene_Document_Html::highlight方法的具體用法?PHP Zend_Search_Lucene_Document_Html::highlight怎麽用?PHP Zend_Search_Lucene_Document_Html::highlight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Search_Lucene_Document_Html的用法示例。


在下文中一共展示了Zend_Search_Lucene_Document_Html::highlight方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: highlight

    /**
     * Highlight specified words
     *
     * @param string|array $words  Words to highlight. They could be organized using the array or string.
     */
    public function highlight($words)
    {
    	$color = $this->_highlightColors[$this->_currentColorIndex];
    	$this->_currentColorIndex = ($this->_currentColorIndex + 1) % count($this->_highlightColors);

    	$this->_doc->highlight($words, $color);
    }
開發者ID:realfluid,項目名稱:umbaugh,代碼行數:12,代碼來源:Default.php

示例2: highlightMatchesDOM

 /**
  * Highlight query terms
  *
  * @param integer &$colorIndex
  * @param Zend_Search_Lucene_Document_Html $doc
  */
 public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex)
 {
     $words = array();
     if ($this->_signs === null) {
         foreach ($this->_terms as $term) {
             $words[] = $term->text;
         }
     } else {
         foreach ($this->_signs as $id => $sign) {
             if ($sign !== false) {
                 $words[] = $this->_terms[$id]->text;
             }
         }
     }
     $doc->highlight($words, $this->_getHighlightColor($colorIndex));
 }
開發者ID:sraj4,項目名稱:EthicsPublicHtmlProd,代碼行數:22,代碼來源:MultiTerm.php

示例3: highlightMatchesDOM

 /**
  * Highlight query terms
  *
  * @param integer &$colorIndex
  * @param Zend_Search_Lucene_Document_Html $doc
  */
 public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex)
 {
     $doc->highlight($this->_term->text, $this->_getHighlightColor($colorIndex));
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:10,代碼來源:Term.php

示例4: highlightMatchesDOM

 /**
  * Highlight query terms
  *
  * @param integer &$colorIndex
  * @param Zend_Search_Lucene_Document_Html $doc
  */
 public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex)
 {
     $words = array();
     foreach ($this->_matches as $term) {
         $words[] = $term->text;
     }
     $doc->highlight($words, $this->_getHighlightColor($colorIndex));
 }
開發者ID:ookwudili,項目名稱:chisimba,代碼行數:14,代碼來源:Range.php

示例5: highlightMatchesDOM

 /**
  * Highlight query terms
  *
  * @param integer &$colorIndex
  * @param Zend_Search_Lucene_Document_Html $doc
  */
 public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex)
 {
     /** @todo implementation */
     $words = array();
     $matchExpression = '/^' . str_replace(array('\\?', '\\*'), array('.', '.*'), preg_quote($this->_pattern->text, '/')) . '$/';
     if (@preg_match('/\\pL/u', 'a') == 1) {
         // PCRE unicode support is turned on
         // add Unicode modifier to the match expression
         $matchExpression .= 'u';
     }
     $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($doc->getFieldUtf8Value('body'), 'UTF-8');
     foreach ($tokens as $token) {
         if (preg_match($matchExpression, $token->getTermText()) === 1) {
             $words[] = $token->getTermText();
         }
     }
     $doc->highlight($words, $this->_getHighlightColor($colorIndex));
 }
開發者ID:ismaelmelus,項目名稱:home,代碼行數:24,代碼來源:Range.php


注:本文中的Zend_Search_Lucene_Document_Html::highlight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。