当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Search_Lucene_Index_TermsPriorityQueue类代码示例

本文整理汇总了PHP中Zend_Search_Lucene_Index_TermsPriorityQueue的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Search_Lucene_Index_TermsPriorityQueue类的具体用法?PHP Zend_Search_Lucene_Index_TermsPriorityQueue怎么用?PHP Zend_Search_Lucene_Index_TermsPriorityQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Search_Lucene_Index_TermsPriorityQueue类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _mergeTerms

 /**
  * Merge fields information
  */
 private function _mergeTerms()
 {
     /** Zend_Search_Lucene_Index_TermsPriorityQueue */
     require_once 'Zend/Search/Lucene/Index/TermsPriorityQueue.php';
     $segmentInfoQueue = new Zend_Search_Lucene_Index_TermsPriorityQueue();
     $segmentStartId = 0;
     foreach ($this->_segmentInfos as $segName => $segmentInfo) {
         $segmentStartId = $segmentInfo->resetTermsStream($segmentStartId, Zend_Search_Lucene_Index_SegmentInfo::SM_MERGE_INFO);
         // Skip "empty" segments
         if ($segmentInfo->currentTerm() !== null) {
             $segmentInfoQueue->put($segmentInfo);
         }
     }
     $this->_writer->initializeDictionaryFiles();
     $termDocs = array();
     while (($segmentInfo = $segmentInfoQueue->pop()) !== null) {
         // Merge positions array
         $termDocs += $segmentInfo->currentTermPositions();
         if ($segmentInfoQueue->top() === null || $segmentInfoQueue->top()->currentTerm()->key() != $segmentInfo->currentTerm()->key()) {
             // We got new term
             ksort($termDocs, SORT_NUMERIC);
             // Add term if it's contained in any document
             if (count($termDocs) > 0) {
                 $this->_writer->addTerm($segmentInfo->currentTerm(), $termDocs);
             }
             $termDocs = array();
         }
         $segmentInfo->nextTerm();
         // check, if segment dictionary is finished
         if ($segmentInfo->currentTerm() !== null) {
             // Put segment back into the priority queue
             $segmentInfoQueue->put($segmentInfo);
         }
     }
     $this->_writer->closeDictionaryFiles();
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:39,代码来源:SegmentMerger.php

示例2: terms

 /**
  * Returns an array of all terms in this index.
  *
  * @return array
  */
 public function terms()
 {
     $result = array();
     /** Zend_Search_Lucene_Index_TermsPriorityQueue */
     // require_once 'Zend/Search/Lucene/Index/TermsPriorityQueue.php';
     $segmentInfoQueue = new Zend_Search_Lucene_Index_TermsPriorityQueue();
     foreach ($this->_segmentInfos as $segmentInfo) {
         $segmentInfo->resetTermsStream();
         // Skip "empty" segments
         if ($segmentInfo->currentTerm() !== null) {
             $segmentInfoQueue->put($segmentInfo);
         }
     }
     while (($segmentInfo = $segmentInfoQueue->pop()) !== null) {
         if ($segmentInfoQueue->top() === null || $segmentInfoQueue->top()->currentTerm()->key() != $segmentInfo->currentTerm()->key()) {
             // We got new term
             $result[] = $segmentInfo->currentTerm();
         }
         if ($segmentInfo->nextTerm() !== null) {
             // Put segment back into the priority queue
             $segmentInfoQueue->put($segmentInfo);
         }
     }
     return $result;
 }
开发者ID:alefernie,项目名称:intranet,代码行数:30,代码来源:Lucene.php

示例3: terms

 public function terms()
 {
     $result = array();
     $segmentInfoQueue = new Zend_Search_Lucene_Index_TermsPriorityQueue();
     foreach ($this->_segmentInfos as $segmentInfo) {
         $segmentInfo->resetTermsStream();
         if ($segmentInfo->currentTerm() !== null) {
             $segmentInfoQueue->put($segmentInfo);
         }
     }
     while (($segmentInfo = $segmentInfoQueue->pop()) !== null) {
         if ($segmentInfoQueue->top() === null || $segmentInfoQueue->top()->currentTerm()->key() != $segmentInfo->currentTerm()->key()) {
             $result[] = $segmentInfo->currentTerm();
         }
         if ($segmentInfo->nextTerm() !== null) {
             $segmentInfoQueue->put($segmentInfo);
         }
     }
     return $result;
 }
开发者ID:Blu2z,项目名称:implsk,代码行数:20,代码来源:Zend_Search_Lucene.php

示例4: closeTermsStream

 /**
  * Close terms stream
  *
  * Should be used for resources clean up if stream is not read up to the end
  */
 public function closeTermsStream()
 {
     while (($termStream = $this->_termsStreamQueue->pop()) !== null) {
         $termStream->closeTermsStream();
     }
     $this->_termsStreamQueue = null;
     $this->_lastTerm = null;
 }
开发者ID:fredcido,项目名称:cenbrap,代码行数:13,代码来源:TermStreamsPriorityQueue.php


注:本文中的Zend_Search_Lucene_Index_TermsPriorityQueue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。