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


PHP Zend_Search_Lucene_Storage_File::readInt方法代码示例

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


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

示例1: reset

 /**
  * Reset terms stream
  *
  * $startId - id for the fist document
  * $compact - remove deleted documents
  *
  * Returns start document id for the next segment
  *
  * @param integer $startId
  * @param boolean $compact
  * @throws Zend_Search_Lucene_Exception
  * @return integer
  */
 public function reset($startId = 0, $compact = false)
 {
     if ($this->_tisFile !== null) {
         $this->_tisFile = null;
     }
     $this->_tisFile = $this->openCompoundFile('.tis', false);
     $tiVersion = $this->_tisFile->readInt();
     if ($tiVersion != (int) 0.0) {
         throw new Zend_Search_Lucene_Exception('Wrong TermInfoFile file format');
     }
     $this->_termCount = $this->_tisFile->readLong();
     $this->_tisFile->readInt();
     // Read Index interval
     $this->_skipInterval = $this->_tisFile->readInt();
     // Read skip interval
     if ($this->_frqFile !== null) {
         $this->_frqFile = null;
     }
     $this->_frqFile = $this->openCompoundFile('.frq', false);
     $this->_frqFileOffset = $this->_frqFile->tell();
     if ($this->_prxFile !== null) {
         $this->_prxFile = null;
     }
     $this->_prxFile = $this->openCompoundFile('.prx', false);
     $this->_prxFileOffset = $this->_prxFile->tell();
     $this->_lastTerm = new Zend_Search_Lucene_Index_Term('', -1);
     $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo(0, 0, 0, 0);
     $this->_docMap = array();
     for ($count = 0; $count < $this->_docCount; $count++) {
         if (!$this->isDeleted($count)) {
             $this->_docMap[$count] = $startId + ($compact ? count($this->_docMap) : $count);
         }
     }
     $this->nextTerm();
     return $startId + ($compact ? count($this->_docMap) : $this->_docCount);
 }
开发者ID:renatosoares,项目名称:blog-zend1,代码行数:49,代码来源:SegmentInfo.php

示例2: resetTermsStream

    /**
     * Reset terms stream
     *
     * $startId - id for the fist document
     * $compact - remove deleted documents
     *
     * Returns start document id for the next segment
     *
     * @param integer $startId
     * @param integer $mode
     * @throws Zend_Search_Lucene_Exception
     * @return integer
     */
    public function resetTermsStream(/** $startId = 0, $mode = self::SM_TERMS_ONLY */)
    {
    	/**
    	 * SegmentInfo->resetTermsStream() method actually takes two optional parameters:
    	 *   $startId (default value is 0)
    	 *   $mode (default value is self::SM_TERMS_ONLY)
    	 */
    	$argList = func_get_args();
    	if (count($argList) > 2) {
            require_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('Wrong number of arguments');
    	} else if (count($argList) == 2) {
    		$startId = $argList[0];
    		$mode    = $argList[1];
    	} else if (count($argList) == 1) {
            $startId = $argList[0];
            $mode    = self::SM_TERMS_ONLY;
        } else {
            $startId = 0;
            $mode    = self::SM_TERMS_ONLY;
        }

        if ($this->_tisFile !== null) {
            $this->_tisFile = null;
        }

        $this->_tisFile = $this->openCompoundFile('.tis', false);
        $this->_tisFileOffset = $this->_tisFile->tell();

        $tiVersion = $this->_tisFile->readInt();
        if ($tiVersion != (int)0xFFFFFFFE /* pre-2.1 format */  &&
            $tiVersion != (int)0xFFFFFFFD /* 2.1+ format    */) {
            require_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('Wrong TermInfoFile file format');
        }

        $this->_termCount     =
              $this->_termNum = $this->_tisFile->readLong(); // Read terms count
        $this->_indexInterval = $this->_tisFile->readInt();  // Read Index interval
        $this->_skipInterval  = $this->_tisFile->readInt();  // Read skip interval
        if ($tiVersion == (int)0xFFFFFFFD /* 2.1+ format */) {
            $maxSkipLevels = $this->_tisFile->readInt();
        }

        if ($this->_frqFile !== null) {
            $this->_frqFile = null;
        }
        if ($this->_prxFile !== null) {
            $this->_prxFile = null;
        }
        $this->_docMap = array();

        $this->_lastTerm          = new Zend_Search_Lucene_Index_Term('', -1);
        $this->_lastTermInfo      = new Zend_Search_Lucene_Index_TermInfo(0, 0, 0, 0);
        $this->_lastTermPositions = null;

        $this->_termsScanMode = $mode;

        switch ($mode) {
            case self::SM_TERMS_ONLY:
                // Do nothing
                break;

            case self::SM_FULL_INFO:
                // break intentionally omitted
            case self::SM_MERGE_INFO:
                $this->_frqFile = $this->openCompoundFile('.frq', false);
                $this->_frqFileOffset = $this->_frqFile->tell();

                $this->_prxFile = $this->openCompoundFile('.prx', false);
                $this->_prxFileOffset = $this->_prxFile->tell();

                for ($count = 0; $count < $this->_docCount; $count++) {
                    if (!$this->isDeleted($count)) {
                        $this->_docMap[$count] = $startId + (($mode == self::SM_MERGE_INFO) ? count($this->_docMap) : $count);
                    }
                }
                break;

            default:
                require_once 'Zend/Search/Lucene/Exception.php';
                throw new Zend_Search_Lucene_Exception('Wrong terms scaning mode specified.');
                break;
        }


        $this->nextTerm();
//.........这里部分代码省略.........
开发者ID:realfluid,项目名称:umbaugh,代码行数:101,代码来源:SegmentInfo.php

示例3: reset

 /**
  * Reset terms stream
  *
  * $startId - id for the fist document
  * $compact - remove deleted documents
  *
  * Returns start document id for the next segment
  *
  * @param integer $startId
  * @param integer $mode
  * @throws Zend_Search_Lucene_Exception
  * @return integer
  */
 public function reset($startId = 0, $mode = self::SM_TERMS_ONLY)
 {
     if ($this->_tisFile !== null) {
         $this->_tisFile = null;
     }
     $this->_tisFile = $this->openCompoundFile('.tis', false);
     $this->_tisFileOffset = $this->_tisFile->tell();
     $tiVersion = $this->_tisFile->readInt();
     if ($tiVersion != (int) 0xfffffffe && $tiVersion != (int) 0xfffffffd) {
         require_once 'Zend/Search/Lucene/Exception.php';
         throw new Zend_Search_Lucene_Exception('Wrong TermInfoFile file format');
     }
     $this->_termCount = $this->_termNum = $this->_tisFile->readLong();
     // Read terms count
     $this->_indexInterval = $this->_tisFile->readInt();
     // Read Index interval
     $this->_skipInterval = $this->_tisFile->readInt();
     // Read skip interval
     if ($tiVersion == (int) 0xfffffffd) {
         $maxSkipLevels = $this->_tisFile->readInt();
     }
     if ($this->_frqFile !== null) {
         $this->_frqFile = null;
     }
     if ($this->_prxFile !== null) {
         $this->_prxFile = null;
     }
     $this->_docMap = array();
     $this->_lastTerm = new Zend_Search_Lucene_Index_Term('', -1);
     $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo(0, 0, 0, 0);
     $this->_lastTermPositions = null;
     $this->_termsScanMode = $mode;
     switch ($mode) {
         case self::SM_TERMS_ONLY:
             // Do nothing
             break;
         case self::SM_FULL_INFO:
             // break intentionally omitted
         // break intentionally omitted
         case self::SM_MERGE_INFO:
             $this->_frqFile = $this->openCompoundFile('.frq', false);
             $this->_frqFileOffset = $this->_frqFile->tell();
             $this->_prxFile = $this->openCompoundFile('.prx', false);
             $this->_prxFileOffset = $this->_prxFile->tell();
             for ($count = 0; $count < $this->_docCount; $count++) {
                 if (!$this->isDeleted($count)) {
                     $this->_docMap[$count] = $startId + ($mode == self::SM_MERGE_INFO ? count($this->_docMap) : $count);
                 }
             }
             break;
         default:
             require_once 'Zend/Search/Lucene/Exception.php';
             throw new Zend_Search_Lucene_Exception('Wrong terms scaning mode specified.');
             break;
     }
     $this->nextTerm();
     return $startId + ($mode == self::SM_MERGE_INFO ? count($this->_docMap) : $this->_docCount);
 }
开发者ID:jcvpalma,项目名称:avaliacao_desenv_php_zend17,代码行数:71,代码来源:SegmentInfo.php


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