Methods Summary |
---|
public void | close()
freqStream.close();
if (skipStream != null)
skipStream.close();
|
public final int | doc() return doc;
|
public final int | freq() return freq;
|
public boolean | next()
while (true) {
if (count == df)
return false;
int docCode = freqStream.readVInt();
doc += docCode >>> 1; // shift off low bit
if ((docCode & 1) != 0) // if low bit is set
freq = 1; // freq is one
else
freq = freqStream.readVInt(); // else read freq
count++;
if (deletedDocs == null || !deletedDocs.get(doc))
break;
skippingDoc();
}
return true;
|
public int | read(int[] docs, int[] freqs)Optimized implementation.
final int length = docs.length;
int i = 0;
while (i < length && count < df) {
// manually inlined call to next() for speed
final int docCode = freqStream.readVInt();
doc += docCode >>> 1; // shift off low bit
if ((docCode & 1) != 0) // if low bit is set
freq = 1; // freq is one
else
freq = freqStream.readVInt(); // else read freq
count++;
if (deletedDocs == null || !deletedDocs.get(doc)) {
docs[i] = doc;
freqs[i] = freq;
++i;
}
}
return i;
|
public void | seek(org.apache.lucene.index.Term term)
TermInfo ti = parent.tis.get(term);
seek(ti);
|
public void | seek(org.apache.lucene.index.TermEnum termEnum)
TermInfo ti;
// use comparison of fieldinfos to verify that termEnum belongs to the same segment as this SegmentTermDocs
if (termEnum instanceof SegmentTermEnum && ((SegmentTermEnum) termEnum).fieldInfos == parent.fieldInfos) // optimized case
ti = ((SegmentTermEnum) termEnum).termInfo();
else // punt case
ti = parent.tis.get(termEnum.term());
seek(ti);
|
void | seek(org.apache.lucene.index.TermInfo ti)
count = 0;
if (ti == null) {
df = 0;
} else {
df = ti.docFreq;
doc = 0;
skipDoc = 0;
skipCount = 0;
numSkips = df / skipInterval;
freqPointer = ti.freqPointer;
proxPointer = ti.proxPointer;
skipPointer = freqPointer + ti.skipOffset;
freqStream.seek(freqPointer);
haveSkipped = false;
}
|
protected void | skipProx(long proxPointer)Overridden by SegmentTermPositions to skip in prox stream.
|
public boolean | skipTo(int target)Optimized implementation.
if (df >= skipInterval) { // optimized case
if (skipStream == null)
skipStream = (InputStream) freqStream.clone(); // lazily clone
if (!haveSkipped) { // lazily seek skip stream
skipStream.seek(skipPointer);
haveSkipped = true;
}
// scan skip data
int lastSkipDoc = skipDoc;
long lastFreqPointer = freqStream.getFilePointer();
long lastProxPointer = -1;
int numSkipped = -1 - (count % skipInterval);
while (target > skipDoc) {
lastSkipDoc = skipDoc;
lastFreqPointer = freqPointer;
lastProxPointer = proxPointer;
if (skipDoc != 0 && skipDoc >= doc)
numSkipped += skipInterval;
if(skipCount >= numSkips)
break;
skipDoc += skipStream.readVInt();
freqPointer += skipStream.readVInt();
proxPointer += skipStream.readVInt();
skipCount++;
}
// if we found something to skip, then skip it
if (lastFreqPointer > freqStream.getFilePointer()) {
freqStream.seek(lastFreqPointer);
skipProx(lastProxPointer);
doc = lastSkipDoc;
count += numSkipped;
}
}
// done skipping, now just scan
do {
if (!next())
return false;
} while (target > doc);
return true;
|
protected void | skippingDoc()
|