Skip to content

Apache Lucene open-source search software

LUCENE-4055: don't populate upgraded SI with bogus stuff

Robert Muirba7f596a671b
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java
index 225be4238ac..27f5d3d27ed 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xSegmentInfoReader.java
@@ -251,22 +251,10 @@ public class Lucene3xSegmentInfoReader extends SegmentInfoReader {
final String version = input.readString();
- // nocommit: we ignore this and use the incoming arg: don't write this
- input.readString();
-
final int docCount = input.readInt();
- // nocommit: dont write this
- final long delGen = input.readLong();
final Map<String,String> attributes = input.readStringStringMap();
- // pre-4.0 indexes write a byte if there is a single norms file
- byte b = input.readByte();
-
- //System.out.println("version=" + version + " name=" + name + " docCount=" + docCount + " delGen=" + delGen + " dso=" + docStoreOffset + " dss=" + docStoreSegment + " dssCFs=" + docStoreIsCompoundFile + " b=" + b + " format=" + format);
-
- // nocommit: don't write this
- assert 1 == b : "expected 1 but was: "+ b;
final int numNormGen = input.readInt();
final Map<Integer,Long> normGen;
if (numNormGen == SegmentInfo.NO) {
@@ -279,17 +267,8 @@ public class Lucene3xSegmentInfoReader extends SegmentInfoReader {
}
final boolean isCompoundFile = input.readByte() == SegmentInfo.YES;
- final int delCount = input.readInt();
- assert delCount <= docCount;
-
- // nocommit: unused, dont write this
- final boolean hasProx = input.readByte() == 1;
-
final Map<String,String> diagnostics = input.readStringStringMap();
- // nocommit: unused, dont write this
- final int hasVectors = input.readByte();
-
final Set<String> files = input.readStringSet();
// nocommit: convert normgen into attributes?
diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
index a5a2018491e..77a82fe372a 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
@@ -423,15 +423,9 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfoPerCom
assert si.getCodec() instanceof Lucene3xCodec : "broken test, trying to mix preflex with other codecs";
// Write the Lucene version that created this segment, since 3.1
output.writeString(si.getVersion());
- output.writeString(si.name);
output.writeInt(si.getDocCount());
- // NOTE: a lie
- output.writeLong(0L);
-
output.writeStringStringMap(si.attributes());
- // pre-4.0 indexes write a byte if there is a single norms file
- output.writeByte((byte) 1);
Map<Integer,Long> normGen = si.getNormGen();
if (normGen == null) {
@@ -444,15 +438,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfoPerCom
}
output.writeByte((byte) (si.getUseCompoundFile() ? SegmentInfo.YES : SegmentInfo.NO));
-
- // NOTE: a lie
- output.writeInt(0);
-
- // hasProx (lie):
- output.writeByte((byte) 1);
output.writeStringStringMap(si.getDiagnostics());
- // hasVectors (lie):
- output.writeByte((byte) 1);
output.writeStringSet(si.files());
success = true;