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


PHP Zend_Search_Lucene_Index_TermsPriorityQueue::top方法代码示例

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


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

示例1: nextTerm

    /**
     * Scans term streams and returns next term
     *
     * @return Zend_Search_Lucene_Index_Term|null
     */
    public function nextTerm()
    {
        while (($termStream = $this->_termsStreamQueue->pop()) !== null) {
            if ($this->_termsStreamQueue->top() === null ||
                $this->_termsStreamQueue->top()->currentTerm()->key() !=
                            $termStream->currentTerm()->key()) {
                // We got new term
                $this->_lastTerm = $termStream->currentTerm();

                if ($termStream->nextTerm() !== null) {
                    // Put segment back into the priority queue
                    $this->_termsStreamQueue->put($termStream);
                }

                return $this->_lastTerm;
            }

            if ($termStream->nextTerm() !== null) {
                // Put segment back into the priority queue
                $this->_termsStreamQueue->put($termStream);
            }
        }

        // End of stream
        $this->_lastTerm = null;

        return null;
    }
开发者ID:realfluid,项目名称:umbaugh,代码行数:33,代码来源:TermStreamsPriorityQueue.php

示例2: _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

示例3: 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

示例4: 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


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