public function openCompoundFile($extension, $shareHandler = true)
    {
        if (($extension == '.fdx'  || $extension == '.fdt')  &&  $this->_usesSharedDocStore) {
            $fdxFName = $this->_sharedDocStoreOptions['segment'] . '.fdx';
            $fdtFName = $this->_sharedDocStoreOptions['segment'] . '.fdt';

            if (!$this->_sharedDocStoreOptions['isCompound']) {
                $fdxFile = $this->_directory->getFileObject($fdxFName, $shareHandler);
                $fdxFile->seek($this->_sharedDocStoreOptions['offset']*8, SEEK_CUR);

                if ($extension == '.fdx') {
                    // '.fdx' file is requested
                    return $fdxFile;
                } else {
                    // '.fdt' file is requested
                    $fdtStartOffset = $fdxFile->readLong();

                    $fdtFile = $this->_directory->getFileObject($fdtFName, $shareHandler);
                    $fdtFile->seek($fdtStartOffset, SEEK_CUR);

                    return $fdtFile;
                }
            }

            if( !isset($this->_sharedDocStoreOptions['files'][$fdxFName]) ) {
                require_once 'Zend/Search/Lucene/Exception.php';
                throw new Zend_Search_Lucene_Exception('Shared doc storage segment compound file doesn\'t contain '
                                       . $fdxFName . ' file.' );
            }
            if( !isset($this->_sharedDocStoreOptions['files'][$fdtFName]) ) {
                require_once 'Zend/Search/Lucene/Exception.php';
                throw new Zend_Search_Lucene_Exception('Shared doc storage segment compound file doesn\'t contain '
                                       . $fdtFName . ' file.' );
            }

            // Open shared docstore segment file
            $cfxFile = $this->_directory->getFileObject($this->_sharedDocStoreOptions['segment'] . '.cfx', $shareHandler);
            // Seek to the start of '.fdx' file within compound file
            $cfxFile->seek($this->_sharedDocStoreOptions['files'][$fdxFName]);
            // Seek to the start of current segment documents section
            $cfxFile->seek($this->_sharedDocStoreOptions['offset']*8, SEEK_CUR);

            if ($extension == '.fdx') {
                // '.fdx' file is requested
                return $cfxFile;
            } else {
                // '.fdt' file is requested
                $fdtStartOffset = $cfxFile->readLong();

                // Seek to the start of '.fdt' file within compound file
                $cfxFile->seek($this->_sharedDocStoreOptions['files'][$fdtFName]);
                // Seek to the start of current segment documents section
                $cfxFile->seek($fdtStartOffset, SEEK_CUR);

                return $fdtFile;
            }
        }

        $filename = $this->_name . $extension;

        if (!$this->_isCompound) {
            return $this->_directory->getFileObject($filename, $shareHandler);
        }

        if( !isset($this->_segFiles[$filename]) ) {
            require_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('Segment compound file doesn\'t contain '
                                       . $filename . ' file.' );
        }

        $file = $this->_directory->getFileObject($this->_name . '.cfs', $shareHandler);
        $file->seek($this->_segFiles[$filename]);
        return $file;
    }
public function openCompoundFile($extension, $shareHandler = true)
    {
        if (($extension == '.fdx'  || $extension == '.fdt')  &&  $this->_usesSharedDocStore) {
            $fdxFName = $this->_sharedDocStoreOptions['segment'] . '.fdx';
            $fdtFName = $this->_sharedDocStoreOptions['segment'] . '.fdt';

            if (!$this->_sharedDocStoreOptions['isCompound']) {
                $fdxFile = $this->_directory->getFileObject($fdxFName, $shareHandler);
                $fdxFile->seek($this->_sharedDocStoreOptions['offset']*8, SEEK_CUR);

                if ($extension == '.fdx') {
                    // '.fdx' file is requested
                    return $fdxFile;
                } else {
                    // '.fdt' file is requested
                    $fdtStartOffset = $fdxFile->readLong();

                    $fdtFile = $this->_directory->getFileObject($fdtFName, $shareHandler);
                    $fdtFile->seek($fdtStartOffset, SEEK_CUR);

                    return $fdtFile;
                }
            }

            if( !isset($this->_sharedDocStoreOptions['files'][$fdxFName]) ) {
                require_once 'Zend/Search/Lucene/Exception.php';
                throw new Zend_Search_Lucene_Exception('Shared doc storage segment compound file doesn\'t contain '
                                       . $fdxFName . ' file.' );
            }
            if( !isset($this->_sharedDocStoreOptions['files'][$fdtFName]) ) {
                require_once 'Zend/Search/Lucene/Exception.php';
                throw new Zend_Search_Lucene_Exception('Shared doc storage segment compound file doesn\'t contain '
                                       . $fdtFName . ' file.' );
            }

            // Open shared docstore segment file
            $cfxFile = $this->_directory->getFileObject($this->_sharedDocStoreOptions['segment'] . '.cfx', $shareHandler);
            // Seek to the start of '.fdx' file within compound file
            $cfxFile->seek($this->_sharedDocStoreOptions['files'][$fdxFName]);
            // Seek to the start of current segment documents section
            $cfxFile->seek($this->_sharedDocStoreOptions['offset']*8, SEEK_CUR);

            if ($extension == '.fdx') {
                // '.fdx' file is requested
                return $cfxFile;
            } else {
                // '.fdt' file is requested
                $fdtStartOffset = $cfxFile->readLong();

                // Seek to the start of '.fdt' file within compound file
                $cfxFile->seek($this->_sharedDocStoreOptions['files'][$fdtFName]);
                // Seek to the start of current segment documents section
                $cfxFile->seek($fdtStartOffset, SEEK_CUR);

                return $fdtFile;
            }
        }

        $filename = $this->_name . $extension;

        if (!$this->_isCompound) {
            return $this->_directory->getFileObject($filename, $shareHandler);
        }

        if( !isset($this->_segFiles[$filename]) ) {
            require_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('Segment compound file doesn\'t contain '
                                       . $filename . ' file.' );
        }

        $file = $this->_directory->getFileObject($this->_name . '.cfs', $shareHandler);
        $file->seek($this->_segFiles[$filename]);
        return $file;
    }
public function openCompoundFile ( $ extension , $ shareHandler = true ) { if ( ( $ extension == '.fdx' || $ extension == '.fdt' ) && $ this -> _usesSharedDocStore ) { $ fdxFName = $ this -> _sharedDocStoreOptions [ 'segment' ] . '.fdx' ; $ fdtFName = $ this -> _sharedDocStoreOptions [ 'segment' ] . '.fdt' ; if ( ! $ this -> _sharedDocStoreOptions [ 'isCompound' ] ) { $ fdxFile = $ this -> _directory -> getFileObject ( $ fdxFName , $ shareHandler ) ; $ fdxFile -> seek ( $ this -> _sharedDocStoreOptions [ 'offset' ] * 8 , SEEK_CUR ) ; if ( $ extension == '.fdx' ) { // '.fdx' file is requested return $ fdxFile ; } else { // '.fdt' file is requested $ fdtStartOffset = $ fdxFile -> readLong ( ) ; $ fdtFile = $ this -> _directory -> getFileObject ( $ fdtFName , $ shareHandler ) ; $ fdtFile -> seek ( $ fdtStartOffset , SEEK_CUR ) ; return $ fdtFile ; } } if ( ! isset ( $ this -> _sharedDocStoreOptions [ 'files' ] [ $ fdxFName ] ) ) { require_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Shared doc storage segment compound file doesn\'t contain ' . $ fdxFName . ' file.' ) ; } if ( ! isset ( $ this -> _sharedDocStoreOptions [ 'files' ] [ $ fdtFName ] ) ) { require_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Shared doc storage segment compound file doesn\'t contain ' . $ fdtFName . ' file.' ) ; } // Open shared docstore segment file $ cfxFile = $ this -> _directory -> getFileObject ( $ this -> _sharedDocStoreOptions [ 'segment' ] . '.cfx' , $ shareHandler ) ; // Seek to the start of '.fdx' file within compound file $ cfxFile -> seek ( $ this -> _sharedDocStoreOptions [ 'files' ] [ $ fdxFName ] ) ; // Seek to the start of current segment documents section $ cfxFile -> seek ( $ this -> _sharedDocStoreOptions [ 'offset' ] * 8 , SEEK_CUR ) ; if ( $ extension == '.fdx' ) { // '.fdx' file is requested return $ cfxFile ; } else { // '.fdt' file is requested $ fdtStartOffset = $ cfxFile -> readLong ( ) ; // Seek to the start of '.fdt' file within compound file $ cfxFile -> seek ( $ this -> _sharedDocStoreOptions [ 'files' ] [ $ fdtFName ] ) ; // Seek to the start of current segment documents section $ cfxFile -> seek ( $ fdtStartOffset , SEEK_CUR ) ; return $ fdtFile ; } } $ filename = $ this -> _name . $ extension ; if ( ! $ this -> _isCompound ) { return $ this -> _directory -> getFileObject ( $ filename , $ shareHandler ) ; } if ( ! isset ( $ this -> _segFiles [ $ filename ] ) ) { require_once 'Zend/Search/Lucene/Exception.php' ; throw new Zend_Search_Lucene_Exception ( 'Segment compound file doesn\'t contain ' . $ filename . ' file.' ) ; } $ file = $ this -> _directory -> getFileObject ( $ this -> _name . '.cfs' , $ shareHandler ) ; $ file -> seek ( $ this -> _segFiles [ $ filename ] ) ; return $ file ; }
Opens index file stoted within compound index file

@param string $extension
@param boolean $shareHandler
@throws Zend_Search_Lucene_Exception
@return Zend_Search_Lucene_Storage_File
Opens index file stoted within compound index file