Пример #1
0
            internal virtual SepDocsAndPositionsEnum Init(FieldInfo fieldInfo, SepTermState termState, IBits liveDocs)
            {
                this.liveDocs = liveDocs;
                storePayloads = fieldInfo.HasPayloads;
                //System.out.println("Sep D&P init");

                // TODO: can't we only do this if consumer
                // skipped consuming the previous docs?
                docIndex.CopyFrom(termState.docIndex);
                docIndex.Seek(docReader);
                //System.out.println("  docIndex=" + docIndex);

                freqIndex.CopyFrom(termState.freqIndex);
                freqIndex.Seek(freqReader);
                //System.out.println("  freqIndex=" + freqIndex);

                posIndex.CopyFrom(termState.posIndex);
                //System.out.println("  posIndex=" + posIndex);
                posSeekPending = true;
                payloadPending = false;

                payloadFP = termState.payloadFP;
                skipFP    = termState.skipFP;
                //System.out.println("  skipFP=" + skipFP);

                docFreq             = termState.DocFreq;
                count               = 0;
                doc                 = -1;
                accum               = 0;
                pendingPosCount     = 0;
                pendingPayloadBytes = 0;
                skipped             = false;

                return(this);
            }
Пример #2
0
            internal virtual SepDocsEnum Init(FieldInfo fieldInfo, SepTermState termState, IBits liveDocs)
            {
                this.liveDocs     = liveDocs;
                this.indexOptions = fieldInfo.IndexOptions;
                omitTF            = indexOptions == IndexOptions.DOCS_ONLY;
                storePayloads     = fieldInfo.HasPayloads;

                // TODO: can't we only do this if consumer
                // skipped consuming the previous docs?
                docIndex.CopyFrom(termState.docIndex);
                docIndex.Seek(docReader);

                if (!omitTF)
                {
                    freqIndex.CopyFrom(termState.freqIndex);
                    freqIndex.Seek(freqReader);
                }

                docFreq = termState.DocFreq;
                // NOTE: unused if docFreq < skipMinimum:
                skipFP  = termState.skipFP;
                count   = 0;
                doc     = -1;
                accum   = 0;
                freq    = 1;
                skipped = false;

                return(this);
            }
Пример #3
0
            public override int NextPosition()
            {
                if (posSeekPending)
                {
                    posIndex.Seek(posReader);
                    payloadIn.Seek(payloadFP);
                    posSeekPending = false;
                }

                // scan over any docs that were iterated without their
                // positions
                while (pendingPosCount > freq)
                {
                    int code2 = posReader.Next();
                    if (storePayloads && (code2 & 1) != 0)
                    {
                        // Payload length has changed
                        payloadLength = posReader.Next();
                        if (Debugging.AssertsEnabled)
                        {
                            Debugging.Assert(payloadLength >= 0);
                        }
                    }
                    pendingPosCount--;
                    position             = 0;
                    pendingPayloadBytes += payloadLength;
                }

                int code = posReader.Next();

                if (storePayloads)
                {
                    if ((code & 1) != 0)
                    {
                        // Payload length has changed
                        payloadLength = posReader.Next();
                        if (Debugging.AssertsEnabled)
                        {
                            Debugging.Assert(payloadLength >= 0);
                        }
                    }
                    position            += (int)(((uint)code) >> 1);
                    pendingPayloadBytes += payloadLength;
                    payloadPending       = payloadLength > 0;
                }
                else
                {
                    position += code;
                }

                pendingPosCount--;
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(pendingPosCount >= 0);
                }
                return(position);
            }