mirror of https://github.com/apache/lucene.git
LUCENE-9096:Simplify CompressingTermVectorsWriter#flushOffsets. (#1125)
This commit is contained in:
parent
f87b4c13bb
commit
2db4c909ca
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue