mirror of https://github.com/apache/lucene.git
LUCENE-4497: don't write PosVIntCount in 4.1 codec
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1400974 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
733654068a
commit
4a17b6a1ed
|
@ -105,6 +105,9 @@ Optimizations
|
|||
the postings data (via flags to TermsEnum.docs/docsAndPositions) to use
|
||||
ForUtil.skipBlock. (Robert Muir)
|
||||
|
||||
* LUCENE-4497: Don't write PosVIntCount to the positions file in
|
||||
Lucene41PostingsFormat, as its always totalTermFreq % BLOCK_SIZE. (Robert Muir)
|
||||
|
||||
Build
|
||||
|
||||
* LUCENE-4451: Memory leak per unique thread caused by
|
||||
|
|
|
@ -274,7 +274,7 @@ import org.apache.lucene.util.packed.PackedInts;
|
|||
* <li>Header --> {@link CodecUtil#writeHeader CodecHeader}</li>
|
||||
* <li>TermPositions --> <PackedPosDeltaBlock> <sup>PackedPosBlockNum</sup>,
|
||||
* VIntBlock? </li>
|
||||
* <li>VIntBlock --> PosVIntCount, <PositionDelta[, PayloadLength?], PayloadData?,
|
||||
* <li>VIntBlock --> <PositionDelta[, PayloadLength?], PayloadData?,
|
||||
* OffsetDelta?, OffsetLength?><sup>PosVIntCount</sup>
|
||||
* <li>PackedPosDeltaBlock --> {@link PackedInts PackedInts}</li>
|
||||
* <li>PosVIntCount, PositionDelta, OffsetDelta, OffsetLength -->
|
||||
|
|
|
@ -597,6 +597,7 @@ public final class Lucene41PostingsReader extends PostingsReaderBase {
|
|||
final boolean indexHasPayloads;
|
||||
|
||||
private int docFreq; // number of docs in this posting list
|
||||
private long totalTermFreq; // number of positions in this posting list
|
||||
private int docUpto; // how many docs we've read
|
||||
private int doc; // doc we last read
|
||||
private int accum; // accumulator for doc deltas
|
||||
|
@ -661,6 +662,7 @@ public final class Lucene41PostingsReader extends PostingsReaderBase {
|
|||
payTermStartFP = termState.payStartFP;
|
||||
docIn.seek(docTermStartFP);
|
||||
skipOffset = termState.skipOffset;
|
||||
totalTermFreq = termState.totalTermFreq;
|
||||
posPendingFP = posTermStartFP;
|
||||
posPendingCount = 0;
|
||||
if (termState.totalTermFreq < BLOCK_SIZE) {
|
||||
|
@ -721,7 +723,7 @@ public final class Lucene41PostingsReader extends PostingsReaderBase {
|
|||
// if (DEBUG) {
|
||||
// System.out.println(" vInt pos block @ fp=" + posIn.getFilePointer() + " hasPayloads=" + indexHasPayloads + " hasOffsets=" + indexHasOffsets);
|
||||
// }
|
||||
final int count = posIn.readVInt();
|
||||
final int count = (int) (totalTermFreq % BLOCK_SIZE);
|
||||
int payloadLength = 0;
|
||||
for(int i=0;i<count;i++) {
|
||||
int code = posIn.readVInt();
|
||||
|
@ -1009,6 +1011,7 @@ public final class Lucene41PostingsReader extends PostingsReaderBase {
|
|||
final boolean indexHasPayloads;
|
||||
|
||||
private int docFreq; // number of docs in this posting list
|
||||
private long totalTermFreq; // number of positions in this posting list
|
||||
private int docUpto; // how many docs we've read
|
||||
private int doc; // doc we last read
|
||||
private int accum; // accumulator for doc deltas
|
||||
|
@ -1100,6 +1103,7 @@ public final class Lucene41PostingsReader extends PostingsReaderBase {
|
|||
payTermStartFP = termState.payStartFP;
|
||||
docIn.seek(docTermStartFP);
|
||||
skipOffset = termState.skipOffset;
|
||||
totalTermFreq = termState.totalTermFreq;
|
||||
posPendingFP = posTermStartFP;
|
||||
payPendingFP = payTermStartFP;
|
||||
posPendingCount = 0;
|
||||
|
@ -1163,7 +1167,7 @@ public final class Lucene41PostingsReader extends PostingsReaderBase {
|
|||
// if (DEBUG) {
|
||||
// System.out.println(" vInt pos block @ fp=" + posIn.getFilePointer() + " hasPayloads=" + indexHasPayloads + " hasOffsets=" + indexHasOffsets);
|
||||
// }
|
||||
final int count = posIn.readVInt();
|
||||
final int count = (int) (totalTermFreq % BLOCK_SIZE);
|
||||
int payloadLength = 0;
|
||||
int offsetLength = 0;
|
||||
payloadByteUpto = 0;
|
||||
|
|
|
@ -417,9 +417,7 @@ public final class Lucene41PostingsWriter extends PostingsWriterBase {
|
|||
} else {
|
||||
lastPosBlockOffset = -1;
|
||||
}
|
||||
if (posBufferUpto > 0) {
|
||||
posOut.writeVInt(posBufferUpto);
|
||||
|
||||
if (posBufferUpto > 0) {
|
||||
// TODO: should we send offsets/payloads to
|
||||
// .pay...? seems wasteful (have to store extra
|
||||
// vLong for low (< BLOCK_SIZE) DF terms = vast vast
|
||||
|
|
Loading…
Reference in New Issue