當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。