LUCENE-9096:Simplify CompressingTermVectorsWriter#flushOffsets. (#1125)

This commit is contained in:
kkewwei 2020-01-06 16:19:08 +08:00 committed by Adrien Grand
parent f87b4c13bb
commit 2db4c909ca
1 changed files with 3 additions and 11 deletions

View File

@ -564,17 +564,9 @@ public final class CompressingTermVectorsWriter extends TermVectorsWriter {
final int fieldNumOff = Arrays.binarySearch(fieldNums, fd.fieldNum);
int pos = 0;
for (int i = 0; i < fd.numTerms; ++i) {
int previousPos = 0;
int previousOff = 0;
for (int j = 0; j < fd.freqs[i]; ++j) {
final int position = positionsBuf[fd.posStart + pos];
final int startOffset = startOffsetsBuf[fd.offStart + pos];
sumPos[fieldNumOff] += position - previousPos;
sumOffsets[fieldNumOff] += startOffset - previousOff;
previousPos = position;
previousOff = startOffset;
++pos;
}
sumPos[fieldNumOff] += positionsBuf[fd.posStart + fd.freqs[i]-1 + pos];
sumOffsets[fieldNumOff] += startOffsetsBuf[fd.offStart + fd.freqs[i]-1 + pos];
pos += fd.freqs[i];
}
assert pos == fd.totalPositions;
}