Beispiel #1
0
        public SepPostingsReader(Directory dir, FieldInfos fieldInfos, SegmentInfo segmentInfo, IOContext context,
                                 Int32StreamFactory intFactory, string segmentSuffix)
        {
            bool success = false;

            try
            {
                string docFileName = IndexFileNames.SegmentFileName(segmentInfo.Name, segmentSuffix, SepPostingsWriter.DOC_EXTENSION);
                docIn = intFactory.OpenInput(dir, docFileName, context);

                skipIn = dir.OpenInput(IndexFileNames.SegmentFileName(segmentInfo.Name, segmentSuffix, SepPostingsWriter.SKIP_EXTENSION), context);

                if (fieldInfos.HasFreq)
                {
                    freqIn = intFactory.OpenInput(dir, IndexFileNames.SegmentFileName(segmentInfo.Name, segmentSuffix, SepPostingsWriter.FREQ_EXTENSION), context);
                }
                else
                {
                    freqIn = null;
                }
                if (fieldInfos.HasProx)
                {
                    posIn     = intFactory.OpenInput(dir, IndexFileNames.SegmentFileName(segmentInfo.Name, segmentSuffix, SepPostingsWriter.POS_EXTENSION), context);
                    payloadIn = dir.OpenInput(IndexFileNames.SegmentFileName(segmentInfo.Name, segmentSuffix, SepPostingsWriter.PAYLOAD_EXTENSION), context);
                }
                else
                {
                    posIn     = null;
                    payloadIn = null;
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    Dispose();
                }
            }
        }
Beispiel #2
0
        internal SepSkipListReader(IndexInput skipStream, Int32IndexInput freqIn, Int32IndexInput docIn, Int32IndexInput posIn,
                                   int maxSkipLevels, int skipInterval)
            : base(skipStream, maxSkipLevels, skipInterval)
        {
            if (freqIn != null)
            {
                _freqIndex = new Int32IndexInput.Index[maxSkipLevels];
            }
            _docIndex = new Int32IndexInput.Index[maxSkipLevels];
            if (posIn != null)
            {
                _posIndex = new Int32IndexInput.Index[m_maxNumberOfSkipLevels];
            }

            for (var i = 0; i < maxSkipLevels; i++)
            {
                if (freqIn != null)
                {
                    _freqIndex[i] = freqIn.GetIndex();
                }

                _docIndex[i] = docIn.GetIndex();

                if (posIn != null)
                {
                    _posIndex[i] = posIn.GetIndex();
                }
            }

            _payloadPointer = new long[maxSkipLevels];
            _payloadLength  = new int[maxSkipLevels];

            _lastFreqIndex = freqIn != null?freqIn.GetIndex() : null;

            _lastDocIndex = docIn.GetIndex();
            _lastPosIndex = posIn != null?posIn.GetIndex() : null;
        }