Exemple #1
0
            public override int NextPosition()
            {
                if (_posSeekPending)
                {
                    _posIndex.Seek(_posReader);
                    _payloadIn.Seek(_payloadFp);
                    _posSeekPending = false;
                }

                int code;

                // scan over any docs that were iterated without their positions
                while (_pendingPosCount > _freq)
                {
                    code = _posReader.Next();
                    if (_storePayloads && (code & 1) != 0)
                    {
                        // Payload length has changed
                        _payloadLength = _posReader.Next();
                        Debug.Assert(_payloadLength >= 0);
                    }
                    _pendingPosCount--;
                    _position             = 0;
                    _pendingPayloadBytes += _payloadLength;
                }

                code = _posReader.Next();

                if (_storePayloads)
                {
                    if ((code & 1) != 0)
                    {
                        // Payload length has changed
                        _payloadLength = _posReader.Next();
                        Debug.Assert(_payloadLength >= 0);
                    }
                    _position            += (int)((uint)code >> 1);
                    _pendingPayloadBytes += _payloadLength;
                    _payloadPending       = _payloadLength > 0;
                }
                else
                {
                    _position += code;
                }

                _pendingPosCount--;
                Debug.Assert(_pendingPosCount >= 0);
                return(_position);
            }
Exemple #2
0
            public override int NextDoc()
            {
                while (true)
                {
                    if (_count == _docFreq)
                    {
                        return(_doc = NO_MORE_DOCS);
                    }

                    _count++;

                    // Decode next doc
                    _accum           += _docReader.Next();
                    _freq             = _freqReader.Next();
                    _pendingPosCount += _freq;

                    if (_liveDocs == null || _liveDocs.Get(_accum))
                    {
                        break;
                    }
                }

                _position = 0;
                return(_doc = _accum);
            }
Exemple #3
0
            public override int NextDoc()
            {
                while (true)
                {
                    if (_count == _docFreq)
                    {
                        return(_doc = NO_MORE_DOCS);
                    }

                    _count++;

                    // Decode next doc
                    //System.out.println("decode docDelta:");
                    _accum += _docReader.Next();

                    if (!_omitTf)
                    {
                        //System.out.println("decode freq:");
                        _freq = _freqReader.Next();
                    }

                    if (_liveDocs == null || _liveDocs.Get(_accum))
                    {
                        break;
                    }
                }
                return(_doc = _accum);
            }