mirror of https://github.com/apache/lucene.git
LUCENE-4055: use version comparator
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4055@1342221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4e457c6cb8
commit
d00b63db82
|
@ -46,6 +46,7 @@ import org.apache.lucene.store.IndexOutput;
|
||||||
import org.apache.lucene.store.NoSuchDirectoryException;
|
import org.apache.lucene.store.NoSuchDirectoryException;
|
||||||
import org.apache.lucene.util.CodecUtil;
|
import org.apache.lucene.util.CodecUtil;
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
|
import org.apache.lucene.util.StringHelper;
|
||||||
import org.apache.lucene.util.ThreadInterruptedException;
|
import org.apache.lucene.util.ThreadInterruptedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,7 +372,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfoPerCom
|
||||||
// If this segment is pre-4.x, perform a one-time
|
// If this segment is pre-4.x, perform a one-time
|
||||||
// "ugprade" to write the .si file for it:
|
// "ugprade" to write the .si file for it:
|
||||||
String version = si.getVersion();
|
String version = si.getVersion();
|
||||||
if (version == null || version.startsWith("3.")) {
|
if (version == null || StringHelper.getVersionComparator().compare(version, "4.0") < 0) {
|
||||||
String fileName = IndexFileNames.segmentFileName(si.name, "", Lucene3xSegmentInfoFormat.SI_EXTENSION);
|
String fileName = IndexFileNames.segmentFileName(si.name, "", Lucene3xSegmentInfoFormat.SI_EXTENSION);
|
||||||
if (!directory.fileExists(fileName)) {
|
if (!directory.fileExists(fileName)) {
|
||||||
upgradedSIFiles.add(write3xInfo(directory, si, IOContext.DEFAULT));
|
upgradedSIFiles.add(write3xInfo(directory, si, IOContext.DEFAULT));
|
||||||
|
|
Loading…
Reference in New Issue