mirror of https://github.com/apache/lucene.git
LUCENE-5850: use correct version comparator (at the moment) for versions in index segments, otherwise this logic will do the wrong thing on the next bugfix release!
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1613988 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
63b9f12570
commit
8f1ca8b847
|
@ -58,6 +58,7 @@ import org.apache.lucene.util.BytesRef;
|
|||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.LongValues;
|
||||
import org.apache.lucene.util.RamUsageEstimator;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.apache.lucene.util.Version;
|
||||
import org.apache.lucene.util.packed.BlockPackedReader;
|
||||
import org.apache.lucene.util.packed.MonotonicBlockPackedReader;
|
||||
|
@ -90,13 +91,8 @@ class Lucene45DocValuesProducer extends DocValuesProducer implements Closeable {
|
|||
/** expert: instantiates a new reader */
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Lucene45DocValuesProducer(SegmentReadState state, String dataCodec, String dataExtension, String metaCodec, String metaExtension) throws IOException {
|
||||
Version ver;
|
||||
try {
|
||||
ver = Version.parseLeniently(state.segmentInfo.getVersion());
|
||||
} catch (IllegalArgumentException e) {
|
||||
ver = null;
|
||||
}
|
||||
lenientFieldInfoCheck = ver == null || !ver.onOrAfter(Version.LUCENE_4_9);
|
||||
String ver = state.segmentInfo.getVersion();
|
||||
lenientFieldInfoCheck = StringHelper.getVersionComparator().compare(ver, "4.9.0") < 0;
|
||||
String metaName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, metaExtension);
|
||||
// read in the entries from the metadata file.
|
||||
ChecksumIndexInput in = state.directory.openChecksumInput(metaName, state.context);
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.apache.lucene.util.Bits;
|
|||
import org.apache.lucene.util.CloseableThreadLocal;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.RamUsageEstimator;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.apache.lucene.util.Version;
|
||||
|
||||
/**
|
||||
|
@ -199,15 +200,8 @@ public final class SegmentReader extends AtomicReader implements Accountable {
|
|||
return;
|
||||
}
|
||||
|
||||
Version ver;
|
||||
try {
|
||||
ver = Version.parseLeniently(si.info.getVersion());
|
||||
} catch (IllegalArgumentException e) {
|
||||
// happened in TestBackwardsCompatibility on a 4.0.0.2 index (no matching
|
||||
// Version constant), anyway it's a pre-4.9 index.
|
||||
ver = null;
|
||||
}
|
||||
if (ver != null && ver.onOrAfter(Version.LUCENE_4_9)) {
|
||||
String ver = si.info.getVersion();
|
||||
if (ver != null && StringHelper.getVersionComparator().compare(ver, "4.9.0") >= 0) {
|
||||
DocValuesProducer baseProducer = null;
|
||||
for (FieldInfo fi : fieldInfos) {
|
||||
if (!fi.hasDocValues()) continue;
|
||||
|
|
Loading…
Reference in New Issue