示例#1
0
            public override int Advance(int target)
            {
                if ((target - outerInstance.skipInterval) >= doc && docFreq >= outerInstance.skipMinimum)
                {
                    // There are enough docs in the posting to have
                    // skip data, and its not too close

                    if (skipper == null)
                    {
                        // This DocsEnum has never done any skipping
                        skipper = new SepSkipListReader((IndexInput)outerInstance.skipIn.Clone(),
                                                        outerInstance.freqIn,
                                                        outerInstance.docIn,
                                                        outerInstance.posIn,
                                                        outerInstance.maxSkipLevels, outerInstance.skipInterval);
                    }

                    if (!skipped)
                    {
                        // We haven't yet skipped for this posting
                        skipper.Init(skipFP,
                                     docIndex,
                                     freqIndex,
                                     posIndex,
                                     0,
                                     docFreq,
                                     storePayloads);
                        skipper.SetIndexOptions(indexOptions);

                        skipped = true;
                    }

                    int newCount = skipper.SkipTo(target);

                    if (newCount > count)
                    {
                        // Skipper did move
                        if (!omitTF)
                        {
                            skipper.FreqIndex.Seek(freqReader);
                        }
                        skipper.DocIndex.Seek(docReader);
                        count = newCount;
                        doc   = accum = skipper.Doc;
                    }
                }

                // Now, linear scan for the rest:
                do
                {
                    if (NextDoc() == NO_MORE_DOCS)
                    {
                        return(NO_MORE_DOCS);
                    }
                } while (target > doc);

                return(doc);
            }
示例#2
0
            public override int Advance(int target)
            {
                if ((target - _outerInstance._skipInterval) >= _doc && _docFreq >= _outerInstance._skipMinimum)
                {
                    // There are enough docs in the posting to have
                    // skip data, and its not too close

                    if (_skipper == null)
                    {
                        // This DocsEnum has never done any skipping
                        _skipper = new SepSkipListReader((IndexInput)_outerInstance._skipIn.Clone(),
                                                         _outerInstance._freqIn,
                                                         _outerInstance._docIn, _outerInstance._posIn, _outerInstance._maxSkipLevels,
                                                         _outerInstance._skipInterval);
                    }

                    if (!_skipped)
                    {
                        // We haven't yet skipped for this posting
                        _skipper.Init(_skipFp, _docIndex, _freqIndex, _posIndex, 0, _docFreq, _storePayloads);
                        _skipper.IndexOptions = _indexOptions;

                        _skipped = true;
                    }

                    int newCount = _skipper.SkipTo(target);

                    if (newCount > _count)
                    {
                        // Skipper did move
                        if (!_omitTf)
                        {
                            _skipper.FreqIndex.Seek(_freqReader);
                        }
                        _skipper.DocIndex.Seek(_docReader);
                        _count = newCount;
                        _doc   = _accum = _skipper.Doc;
                    }
                }

                // Now, linear scan for the rest:
                do
                {
                    if (NextDoc() == NO_MORE_DOCS)
                    {
                        return(NO_MORE_DOCS);
                    }
                } while (target > _doc);

                return(_doc);
            }
示例#3
0
            public override int Advance(int target)
            {
                //System.out.println("SepD&P advance target=" + target + " vs current=" + doc + " this=" + this);

                if ((target - outerInstance.skipInterval) >= doc && docFreq >= outerInstance.skipMinimum)
                {
                    // There are enough docs in the posting to have
                    // skip data, and its not too close

                    if (skipper == null)
                    {
                        //System.out.println("  create skipper");
                        // This DocsEnum has never done any skipping
                        skipper = new SepSkipListReader((IndexInput)outerInstance.skipIn.Clone(),
                                                        outerInstance.freqIn,
                                                        outerInstance.docIn,
                                                        outerInstance.posIn,
                                                        outerInstance.maxSkipLevels, outerInstance.skipInterval);
                    }

                    if (!skipped)
                    {
                        //System.out.println("  init skip data skipFP=" + skipFP);
                        // We haven't yet skipped for this posting
                        skipper.Init(skipFP,
                                     docIndex,
                                     freqIndex,
                                     posIndex,
                                     payloadFP,
                                     docFreq,
                                     storePayloads);
                        skipper.SetIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
                        skipped = true;
                    }
                    int newCount = skipper.SkipTo(target);
                    //System.out.println("  skip newCount=" + newCount + " vs " + count);

                    if (newCount > count)
                    {
                        // Skipper did move
                        skipper.FreqIndex.Seek(freqReader);
                        skipper.DocIndex.Seek(docReader);
                        //System.out.println("  doc seek'd to " + skipper.getDocIndex());
                        // NOTE: don't seek pos here; do it lazily
                        // instead.  Eg a PhraseQuery may skip to many
                        // docs before finally asking for positions...
                        posIndex.CopyFrom(skipper.PosIndex);
                        posSeekPending = true;
                        count          = newCount;
                        doc            = accum = skipper.Doc;
                        //System.out.println("    moved to doc=" + doc);
                        //payloadIn.seek(skipper.getPayloadPointer());
                        payloadFP           = skipper.PayloadPointer;
                        pendingPosCount     = 0;
                        pendingPayloadBytes = 0;
                        payloadPending      = false;
                        payloadLength       = skipper.PayloadLength;
                        //System.out.println("    move payloadLen=" + payloadLength);
                    }
                }

                // Now, linear scan for the rest:
                do
                {
                    if (NextDoc() == NO_MORE_DOCS)
                    {
                        //System.out.println("  advance nextDoc=END");
                        return(NO_MORE_DOCS);
                    }
                    //System.out.println("  advance nextDoc=" + doc);
                } while (target > doc);

                //System.out.println("  return doc=" + doc);
                return(doc);
            }
示例#4
0
            public override int Advance(int target)
            {
                //System.out.println("SepD&P advance target=" + target + " vs current=" + doc + " this=" + this);

                if ((target - _outerInstance._skipInterval) >= _doc && _docFreq >= _outerInstance._skipMinimum)
                {
                    // There are enough docs in the posting to have
                    // skip data, and its not too close

                    if (_skipper == null)
                    {
                        //System.out.println("  create skipper");
                        // This DocsEnum has never done any skipping
                        _skipper = new SepSkipListReader((IndexInput)_outerInstance._skipIn.Clone(),
                                                         _outerInstance._freqIn,
                                                         _outerInstance._docIn, _outerInstance._posIn, _outerInstance._maxSkipLevels,
                                                         _outerInstance._skipInterval);
                    }

                    if (!_skipped)
                    {
                        //System.out.println("  init skip data skipFP=" + skipFP);
                        // We haven't yet skipped for this posting
                        _skipper.Init(_skipFp, _docIndex, _freqIndex, _posIndex, _payloadFp, _docFreq, _storePayloads);
                        _skipper.IndexOptions = FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
                        _skipped = true;
                    }

                    int newCount = _skipper.SkipTo(target);

                    if (newCount > _count)
                    {
                        // Skipper did move
                        _skipper.FreqIndex.Seek(_freqReader);
                        _skipper.DocIndex.Seek(_docReader);

                        // NOTE: don't seek pos here; do it lazily
                        // instead.  Eg a PhraseQuery may skip to many
                        // docs before finally asking for positions...

                        _posIndex.CopyFrom(_skipper.PosIndex);
                        _posSeekPending = true;
                        _count          = newCount;
                        _doc            = _accum = _skipper.Doc;

                        _payloadFp           = _skipper.PayloadPointer;
                        _pendingPosCount     = 0;
                        _pendingPayloadBytes = 0;
                        _payloadPending      = false;
                        _payloadLength       = _skipper.PayloadLength;
                    }
                }

                // Now, linear scan for the rest:
                do
                {
                    if (NextDoc() == NO_MORE_DOCS)
                    {
                        return(NO_MORE_DOCS);
                    }
                } while (target > _doc);

                return(_doc);
            }