当前位置: 首页>>代码示例>>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;未经允许,请勿转载。