diff --git a/core/src/main/java/org/elasticsearch/Version.java b/core/src/main/java/org/elasticsearch/Version.java index ac2575597e8..e55800682dd 100644 --- a/core/src/main/java/org/elasticsearch/Version.java +++ b/core/src/main/java/org/elasticsearch/Version.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.monitor.jvm.JvmInfo; @@ -286,7 +285,8 @@ public class Version { public static final Version CURRENT = V_3_0_0; static { - assert CURRENT.luceneVersion.equals(Lucene.VERSION) : "Version must be upgraded to [" + Lucene.VERSION + "] is still set to [" + CURRENT.luceneVersion + "]"; + assert CURRENT.luceneVersion.equals(org.apache.lucene.util.Version.LATEST) : "Version must be upgraded to [" + + org.apache.lucene.util.Version.LATEST + "] is still set to [" + CURRENT.luceneVersion + "]"; } public static Version readVersion(StreamInput in) throws IOException { @@ -457,7 +457,6 @@ public class Version { return V_0_90_0_RC1; case V_0_90_0_Beta1_ID: return V_0_90_0_Beta1; - case V_0_20_7_ID: return V_0_20_7; case V_0_20_6_ID: @@ -476,7 +475,6 @@ public class Version { return V_0_20_0; case V_0_20_0_RC1_ID: return V_0_20_0_RC1; - case V_0_19_0_RC1_ID: return V_0_19_0_RC1; case V_0_19_0_RC2_ID: @@ -511,7 +509,6 @@ public class Version { return V_0_19_12; case V_0_19_13_ID: return V_0_19_13; - case V_0_18_0_ID: return V_0_18_0; case V_0_18_1_ID: @@ -530,9 +527,8 @@ public class Version { return V_0_18_7; case V_0_18_8_ID: return V_0_18_8; - default: - return new Version(id, false, Lucene.VERSION); + return new Version(id, false, org.apache.lucene.util.Version.LATEST); } } diff --git a/core/src/main/java/org/elasticsearch/common/lucene/Lucene.java b/core/src/main/java/org/elasticsearch/common/lucene/Lucene.java index 558e92c4fb8..b693af1e6d1 100644 --- a/core/src/main/java/org/elasticsearch/common/lucene/Lucene.java +++ b/core/src/main/java/org/elasticsearch/common/lucene/Lucene.java @@ -86,11 +86,6 @@ import java.util.Objects; * */ public class Lucene { - - // TODO: remove VERSION, and have users use Version.LATEST. - public static final Version VERSION = Version.LATEST; - public static final Version ANALYZER_VERSION = VERSION; - public static final Version QUERYPARSER_VERSION = VERSION; public static final String LATEST_DOC_VALUES_FORMAT = "Lucene54"; public static final String LATEST_POSTINGS_FORMAT = "Lucene50"; public static final String LATEST_CODEC = "Lucene54"; @@ -109,7 +104,6 @@ public class Lucene { public static final TopDocs EMPTY_TOP_DOCS = new TopDocs(0, EMPTY_SCORE_DOCS, 0.0f); - @SuppressWarnings("deprecation") public static Version parseVersion(@Nullable String version, Version defaultVersion, ESLogger logger) { if (version == null) { return defaultVersion; diff --git a/core/src/main/java/org/elasticsearch/index/analysis/Analysis.java b/core/src/main/java/org/elasticsearch/index/analysis/Analysis.java index 43c9af672d1..a27b49b9618 100644 --- a/core/src/main/java/org/elasticsearch/index/analysis/Analysis.java +++ b/core/src/main/java/org/elasticsearch/index/analysis/Analysis.java @@ -89,12 +89,12 @@ public class Analysis { // check for explicit version on the specific analyzer component String sVersion = settings.get("version"); if (sVersion != null) { - return Lucene.parseVersion(sVersion, Lucene.ANALYZER_VERSION, logger); + return Lucene.parseVersion(sVersion, Version.LATEST, logger); } // check for explicit version on the index itself as default for all analysis components sVersion = indexSettings.get("index.analysis.version"); if (sVersion != null) { - return Lucene.parseVersion(sVersion, Lucene.ANALYZER_VERSION, logger); + return Lucene.parseVersion(sVersion, Version.LATEST, logger); } // resolve the analysis version based on the version the index was created with return org.elasticsearch.Version.indexCreated(indexSettings).luceneVersion; diff --git a/core/src/test/java/org/elasticsearch/common/lucene/LuceneTests.java b/core/src/test/java/org/elasticsearch/common/lucene/LuceneTests.java index 0a15693dfd5..484b88f096f 100644 --- a/core/src/test/java/org/elasticsearch/common/lucene/LuceneTests.java +++ b/core/src/test/java/org/elasticsearch/common/lucene/LuceneTests.java @@ -38,7 +38,6 @@ import org.apache.lucene.search.TermQuery; import org.apache.lucene.store.Directory; import org.apache.lucene.store.MMapDirectory; import org.apache.lucene.store.MockDirectoryWrapper; -import org.apache.lucene.util.Version; import org.elasticsearch.test.ESTestCase; import java.io.IOException; @@ -54,14 +53,6 @@ import java.util.concurrent.atomic.AtomicBoolean; * */ public class LuceneTests extends ESTestCase { - /** - * simple test that ensures that we bump the version on Upgrade - */ - public void testVersion() { - // note this is just a silly sanity check, we test it in lucene, and we point to it this way - assertEquals(Lucene.VERSION, Version.LATEST); - } - public void testWaitForIndex() throws Exception { final MockDirectoryWrapper dir = newMockDirectory();