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); }
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); }