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


PHP Zend_Search_Lucene_Storage_File::seek方法代碼示例

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


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

示例1: closeDictionaryFiles

 /**
  * Close dictionary
  */
 public function closeDictionaryFiles()
 {
     $this->_tisFile->seek(4);
     $this->_tisFile->writeLong($this->_termCount);
     $this->_tiiFile->seek(4);
     // + 1 is used to count an additional special index entry (empty term at the start of the list)
     $this->_tiiFile->writeLong(($this->_termCount - $this->_termCount % self::$indexInterval) / self::$indexInterval + 1);
 }
開發者ID:alefernie,項目名稱:intranet,代碼行數:11,代碼來源:SegmentWriter.php

示例2: nextTerm

    /**
     * Scans terms dictionary and returns next term
     *
     * @return Zend_Search_Lucene_Index_Term|null
     */
    public function nextTerm()
    {
        if ($this->_tisFile === null  ||  $this->_termCount == 0) {
            $this->_lastTerm          = null;
            $this->_lastTermInfo      = null;
            $this->_lastTermPositions = null;
            $this->_docMap            = null;

            // may be necessary for "empty" segment
            $this->_tisFile = null;
            $this->_frqFile = null;
            $this->_prxFile = null;

            return null;
        }

        $termPrefixLength = $this->_tisFile->readVInt();
        $termSuffix       = $this->_tisFile->readString();
        $termFieldNum     = $this->_tisFile->readVInt();
        $termValue        = Zend_Search_Lucene_Index_Term::getPrefix($this->_lastTerm->text, $termPrefixLength) . $termSuffix;

        $this->_lastTerm = new Zend_Search_Lucene_Index_Term($termValue, $this->_fields[$termFieldNum]->name);

        $docFreq     = $this->_tisFile->readVInt();
        $freqPointer = $this->_lastTermInfo->freqPointer + $this->_tisFile->readVInt();
        $proxPointer = $this->_lastTermInfo->proxPointer + $this->_tisFile->readVInt();
        if ($docFreq >= $this->_skipInterval) {
            $skipOffset = $this->_tisFile->readVInt();
        } else {
            $skipOffset = 0;
        }

        $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo($docFreq, $freqPointer, $proxPointer, $skipOffset);


        if ($this->_termsScanMode == self::SM_FULL_INFO  ||  $this->_termsScanMode == self::SM_MERGE_INFO) {
            $this->_lastTermPositions = array();

            $this->_frqFile->seek($this->_lastTermInfo->freqPointer + $this->_frqFileOffset, SEEK_SET);
            $freqs = array();   $docId = 0;
            for( $count = 0; $count < $this->_lastTermInfo->docFreq; $count++ ) {
                $docDelta = $this->_frqFile->readVInt();
                if( $docDelta % 2 == 1 ) {
                    $docId += ($docDelta-1)/2;
                    $freqs[ $docId ] = 1;
                } else {
                    $docId += $docDelta/2;
                    $freqs[ $docId ] = $this->_frqFile->readVInt();
                }
            }

            $this->_prxFile->seek($this->_lastTermInfo->proxPointer + $this->_prxFileOffset, SEEK_SET);
            foreach ($freqs as $docId => $freq) {
                $termPosition = 0;  $positions = array();

                for ($count = 0; $count < $freq; $count++ ) {
                    $termPosition += $this->_prxFile->readVInt();
                    $positions[] = $termPosition;
                }

                if (isset($this->_docMap[$docId])) {
                    $this->_lastTermPositions[$this->_docMap[$docId]] = $positions;
                }
            }
        }

        $this->_termCount--;
        if ($this->_termCount == 0) {
            $this->_tisFile = null;
            $this->_frqFile = null;
            $this->_prxFile = null;
        }

        return $this->_lastTerm;
    }
開發者ID:realfluid,項目名稱:umbaugh,代碼行數:80,代碼來源:SegmentInfo.php

示例3: closeDictionaryFiles

 /**
  * Close dictionary
  */
 public function closeDictionaryFiles()
 {
     $this->_tisFile->seek(4);
     $this->_tisFile->writeLong($this->_termCount);
     $this->_tiiFile->seek(4);
     $this->_tiiFile->writeLong(ceil(($this->_termCount + 2) / self::$indexInterval));
 }
開發者ID:5haman,項目名稱:knowledgetree,代碼行數:10,代碼來源:SegmentWriter.php


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