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);
|
final int fieldNumOff = Arrays.binarySearch(fieldNums, fd.fieldNum);
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (int i = 0; i < fd.numTerms; ++i) {
|
for (int i = 0; i < fd.numTerms; ++i) {
|
||||||
int previousPos = 0;
|
sumPos[fieldNumOff] += positionsBuf[fd.posStart + fd.freqs[i]-1 + pos];
|
||||||
int previousOff = 0;
|
sumOffsets[fieldNumOff] += startOffsetsBuf[fd.offStart + fd.freqs[i]-1 + pos];
|
||||||
for (int j = 0; j < fd.freqs[i]; ++j) {
|
pos += fd.freqs[i];
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
assert pos == fd.totalPositions;
|
assert pos == fd.totalPositions;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue