LUCENE-3069: remove redundant info for fields without payload

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3069@1502991 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Han Jiang 2013-07-14 16:31:00 +00:00
parent 3c82f0a0d2
commit 9bc7640fd1
2 changed files with 12 additions and 4 deletions

View File

@ -210,8 +210,10 @@ public final class TempPostingsReader extends TempPostingsReaderBase {
termState.docStartFP = longs[0]; termState.docStartFP = longs[0];
if (fieldHasPositions) { if (fieldHasPositions) {
termState.posStartFP = longs[1]; termState.posStartFP = longs[1];
if (fieldHasOffsets || fieldHasPayloads) {
termState.payStartFP = longs[2]; termState.payStartFP = longs[2];
} }
}
if (termState.docFreq == 1) { if (termState.docFreq == 1) {
termState.singletonDocID = in.readVInt(); termState.singletonDocID = in.readVInt();

View File

@ -206,9 +206,13 @@ public final class TempPostingsWriter extends TempPostingsWriterBase {
fieldHasPayloads = fieldInfo.hasPayloads(); fieldHasPayloads = fieldInfo.hasPayloads();
skipWriter.setField(fieldHasPositions, fieldHasOffsets, fieldHasPayloads); skipWriter.setField(fieldHasPositions, fieldHasOffsets, fieldHasPayloads);
if (fieldHasPositions) { if (fieldHasPositions) {
if (fieldHasPayloads || fieldHasOffsets) {
return 3; // doc + pos + pay FP return 3; // doc + pos + pay FP
} else { } else {
return 1; // docFP return 2; // doc + pos FP
}
} else {
return 1; // doc FP
} }
} }
@ -503,8 +507,10 @@ public final class TempPostingsWriter extends TempPostingsWriterBase {
longs[0] = docTermStartFP; longs[0] = docTermStartFP;
if (fieldHasPositions) { if (fieldHasPositions) {
longs[1] = posTermStartFP; longs[1] = posTermStartFP;
if (fieldHasPayloads || fieldHasOffsets) {
longs[2] = payTermStartFP; longs[2] = payTermStartFP;
} }
}
if (singletonDocID != -1) { if (singletonDocID != -1) {
out.writeVInt(singletonDocID); out.writeVInt(singletonDocID);
} }