diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 8b75587e2ea..b9f737ac212 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -107,6 +107,13 @@ API Changes longer receives the number of fields that will be added (Robert Muir, Mike McCandless) +* LUCENE-5632: In preparation for coming Lucene versions, the Version + enum constants were renamed to make them better readable. The constant + for Lucene 4.9 is now "LUCENE_4_9". Version.parseLeniently() is still + able to parse the old strings ("LUCENE_49"). The old identifiers got + deprecated and will be removed in Lucene 5.0. (Uwe Schindler, + Robert Muir) + Optimizations * LUCENE-5603: hunspell stemmer more efficiently strips prefixes diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/CompoundWordTokenFilterBase.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/CompoundWordTokenFilterBase.java index 255a95a3360..60866579ad7 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/CompoundWordTokenFilterBase.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/CompoundWordTokenFilterBase.java @@ -157,7 +157,7 @@ public abstract class CompoundWordTokenFilterBase extends TokenFilter { int startOff = CompoundWordTokenFilterBase.this.offsetAtt.startOffset(); int endOff = CompoundWordTokenFilterBase.this.offsetAtt.endOffset(); - if (matchVersion.onOrAfter(Version.LUCENE_44) || + if (matchVersion.onOrAfter(Version.LUCENE_4_4) || endOff - startOff != CompoundWordTokenFilterBase.this.termAtt.length()) { // if length by start + end offsets doesn't match the term text then assume // this is a synonym and don't adjust the offsets. diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilter.java index a0b0468cf0d..f93c0a7e773 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilter.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilter.java @@ -208,7 +208,7 @@ public final class WordDelimiterFilter extends TokenFilter { */ public WordDelimiterFilter(Version matchVersion, TokenStream in, byte[] charTypeTable, int configurationFlags, CharArraySet protWords) { super(in); - if (!matchVersion.onOrAfter(Version.LUCENE_48)) { + if (!matchVersion.onOrAfter(Version.LUCENE_4_8)) { throw new IllegalArgumentException("This class only works with Lucene 4.8+. To emulate the old (broken) behavior of WordDelimiterFilter, use Lucene47WordDelimiterFilter"); } this.flags = configurationFlags; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java index aebb061994f..c5c478da771 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilterFactory.java @@ -118,7 +118,7 @@ public class WordDelimiterFilterFactory extends TokenFilterFactory implements Re @Override public TokenFilter create(TokenStream input) { - if (luceneMatchVersion.onOrAfter(Version.LUCENE_48)) { + if (luceneMatchVersion.onOrAfter(Version.LUCENE_4_8)) { return new WordDelimiterFilter(luceneMatchVersion, input, typeTable == null ? WordDelimiterIterator.DEFAULT_WORD_DELIM_TABLE : typeTable, flags, protectedWords); } else { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilter.java index c5013c5eb79..20fda83c449 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilter.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilter.java @@ -79,7 +79,7 @@ public final class EdgeNGramTokenFilter extends TokenFilter { throw new IllegalArgumentException("minGram must not be greater than maxGram"); } - this.charUtils = version.onOrAfter(Version.LUCENE_44) + this.charUtils = version.onOrAfter(Version.LUCENE_4_4) ? CharacterUtils.getInstance(version) : CharacterUtils.getJava4Instance(); this.minGram = minGram; diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenFilter.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenFilter.java index 53d325d80c2..ba87146a44f 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenFilter.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenFilter.java @@ -41,7 +41,7 @@ import org.apache.lucene.util.Version; * increasing length (meaning that "abc" will give "a", "ab", "abc", "b", "bc", * "c"). *
You can make this filter use the old behavior by providing a version < - * {@link Version#LUCENE_44} in the constructor but this is not recommended as + * {@link Version#LUCENE_4_4} in the constructor but this is not recommended as * it will lead to broken {@link TokenStream}s that will cause highlighting * bugs. *
If you were using this {@link TokenFilter} to perform partial highlighting,
@@ -83,7 +83,7 @@ public final class NGramTokenFilter extends TokenFilter {
public NGramTokenFilter(Version version, TokenStream input, int minGram, int maxGram) {
super(new CodepointCountFilter(version, input, minGram, Integer.MAX_VALUE));
this.version = version;
- this.charUtils = version.onOrAfter(Version.LUCENE_44)
+ this.charUtils = version.onOrAfter(Version.LUCENE_4_4)
? CharacterUtils.getInstance(version)
: CharacterUtils.getJava4Instance();
if (minGram < 1) {
@@ -94,7 +94,7 @@ public final class NGramTokenFilter extends TokenFilter {
}
this.minGram = minGram;
this.maxGram = maxGram;
- if (version.onOrAfter(Version.LUCENE_44)) {
+ if (version.onOrAfter(Version.LUCENE_4_4)) {
posIncAtt = addAttribute(PositionIncrementAttribute.class);
posLenAtt = addAttribute(PositionLengthAttribute.class);
} else {
@@ -149,7 +149,7 @@ public final class NGramTokenFilter extends TokenFilter {
hasIllegalOffsets = (tokStart + curTermLength) != tokEnd;
}
}
- if (version.onOrAfter(Version.LUCENE_44)) {
+ if (version.onOrAfter(Version.LUCENE_4_4)) {
if (curGramSize > maxGram || (curPos + curGramSize) > curCodePointCount) {
++curPos;
curGramSize = minGram;
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizer.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizer.java
index 7f45f8b1d87..34f44a69072 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizer.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizer.java
@@ -116,10 +116,10 @@ public class NGramTokenizer extends Tokenizer {
}
private void init(Version version, int minGram, int maxGram, boolean edgesOnly) {
- if (!edgesOnly && !version.onOrAfter(Version.LUCENE_44)) {
+ if (!edgesOnly && !version.onOrAfter(Version.LUCENE_4_4)) {
throw new IllegalArgumentException("This class only works with Lucene 4.4+. To emulate the old (broken) behavior of NGramTokenizer, use Lucene43NGramTokenizer");
}
- charUtils = version.onOrAfter(Version.LUCENE_44)
+ charUtils = version.onOrAfter(Version.LUCENE_4_4)
? CharacterUtils.getInstance(version)
: CharacterUtils.getJava4Instance();
if (minGram < 1) {
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizerFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizerFactory.java
index 3a0c2203efc..14bba0f2d51 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizerFactory.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramTokenizerFactory.java
@@ -52,7 +52,7 @@ public class NGramTokenizerFactory extends TokenizerFactory {
/** Creates the {@link TokenStream} of n-grams from the given {@link Reader} and {@link AttributeFactory}. */
@Override
public Tokenizer create(AttributeFactory factory) {
- if (luceneMatchVersion.onOrAfter(Version.LUCENE_44)) {
+ if (luceneMatchVersion.onOrAfter(Version.LUCENE_4_4)) {
return new NGramTokenizer(luceneMatchVersion, factory, minGramSize, maxGramSize);
} else {
return new Lucene43NGramTokenizer(factory, minGramSize, maxGramSize);
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java
index 6a5b2accae5..12e27ad2aff 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java
@@ -102,7 +102,7 @@ public final class ThaiAnalyzer extends StopwordAnalyzerBase {
*/
@Override
protected TokenStreamComponents createComponents(String fieldName) {
- if (matchVersion.onOrAfter(Version.LUCENE_48)) {
+ if (matchVersion.onOrAfter(Version.LUCENE_4_8)) {
final Tokenizer source = new ThaiTokenizer();
TokenStream result = new LowerCaseFilter(matchVersion, source);
result = new StopFilter(matchVersion, result, stopwords);
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/TurkishAnalyzer.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/TurkishAnalyzer.java
index 073c7976f86..0c8842bbfe5 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/TurkishAnalyzer.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/tr/TurkishAnalyzer.java
@@ -122,7 +122,7 @@ public final class TurkishAnalyzer extends StopwordAnalyzerBase {
protected TokenStreamComponents createComponents(String fieldName) {
final Tokenizer source = new StandardTokenizer(matchVersion);
TokenStream result = new StandardFilter(matchVersion, source);
- if(matchVersion.onOrAfter(Version.LUCENE_48))
+ if(matchVersion.onOrAfter(Version.LUCENE_4_8))
result = new ApostropheFilter(result);
result = new TurkishLowerCaseFilter(result);
result = new StopFilter(matchVersion, result, stopwords);
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopFilter.java
index 8f43c011891..972f8731912 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopFilter.java
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopFilter.java
@@ -73,7 +73,7 @@ public class TestStopFilter extends BaseTokenStreamTestCase {
StringReader reader = new StringReader(sb.toString());
final MockTokenizer in = new MockTokenizer(MockTokenizer.WHITESPACE, false);
in.setReader(reader);
- StopFilter stpf = new StopFilter(Version.LUCENE_40, in, stopSet);
+ StopFilter stpf = new StopFilter(Version.LUCENE_4_0, in, stopSet);
doTestStopPositons(stpf);
// with increments, concatenating two stop filters
ArrayList
* Use this to get the latest & greatest settings, bug
* fixes, etc, for Lucene.
*/
- LUCENE_50,
+ LUCENE_5_0,
/* Add new constants for later versions **here** to respect order! */
@@ -136,7 +136,10 @@ public enum Version {
}
public static Version parseLeniently(String version) {
- String parsedMatchVersion = version.toUpperCase(Locale.ROOT);
- return Version.valueOf(parsedMatchVersion.replaceFirst("^(\\d)\\.(\\d)$", "LUCENE_$1$2"));
+ final String parsedMatchVersion = version
+ .toUpperCase(Locale.ROOT)
+ .replaceFirst("^(\\d+)\\.(\\d+)$", "LUCENE_$1_$2")
+ .replaceFirst("^LUCENE_(\\d)(\\d)$", "LUCENE_$1_$2");
+ return Version.valueOf(parsedMatchVersion);
}
}
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
index da00399cf57..a6f55c4258a 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
@@ -2431,7 +2431,7 @@ public class TestIndexWriter extends LuceneTestCase {
Directory dir = newDirectory();
// If version is < 50 IW.close should throw an exception
// on uncommitted changes:
- IndexWriterConfig iwc = newIndexWriterConfig(Version.LUCENE_48, new MockAnalyzer(random()));
+ IndexWriterConfig iwc = newIndexWriterConfig(Version.LUCENE_4_8, new MockAnalyzer(random()));
IndexWriter w = new IndexWriter(dir, iwc);
Document doc = new Document();
doc.add(new SortedDocValuesField("dv", new BytesRef("foo!")));
@@ -2455,7 +2455,7 @@ public class TestIndexWriter extends LuceneTestCase {
// If version is < 50 IW.close should throw an exception
// on still-running merges:
- IndexWriterConfig iwc = newIndexWriterConfig(Version.LUCENE_48, new MockAnalyzer(random()));
+ IndexWriterConfig iwc = newIndexWriterConfig(Version.LUCENE_4_8, new MockAnalyzer(random()));
LogDocMergePolicy mp = new LogDocMergePolicy();
mp.setMergeFactor(2);
iwc.setMergePolicy(mp);
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestControlledRealTimeReopenThread.java b/lucene/core/src/test/org/apache/lucene/search/TestControlledRealTimeReopenThread.java
index c645db596ed..a4afe731ac7 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestControlledRealTimeReopenThread.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestControlledRealTimeReopenThread.java
@@ -475,7 +475,7 @@ public class TestControlledRealTimeReopenThread extends ThreadedIndexingAndSearc
final SnapshotDeletionPolicy sdp = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
final Directory dir = new NRTCachingDirectory(newFSDirectory(createTempDir("nrt")), 5, 128);
- IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_46,
+ IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_4_6,
new MockAnalyzer(random()));
config.setIndexDeletionPolicy(sdp);
config.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
diff --git a/lucene/core/src/test/org/apache/lucene/util/TestVersion.java b/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
index c79fd85113e..e079269f122 100644
--- a/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
+++ b/lucene/core/src/test/org/apache/lucene/util/TestVersion.java
@@ -23,13 +23,14 @@ public class TestVersion extends LuceneTestCase {
for (Version v : Version.values()) {
assertTrue("LUCENE_CURRENT must be always onOrAfter("+v+")", Version.LUCENE_CURRENT.onOrAfter(v));
}
- assertTrue(Version.LUCENE_50.onOrAfter(Version.LUCENE_40));
- assertFalse(Version.LUCENE_40.onOrAfter(Version.LUCENE_50));
+ assertTrue(Version.LUCENE_5_0.onOrAfter(Version.LUCENE_4_0));
+ assertFalse(Version.LUCENE_4_0.onOrAfter(Version.LUCENE_5_0));
}
public void testParseLeniently() {
- assertEquals(Version.LUCENE_40, Version.parseLeniently("4.0"));
- assertEquals(Version.LUCENE_40, Version.parseLeniently("LUCENE_40"));
+ assertEquals(Version.LUCENE_4_0, Version.parseLeniently("4.0"));
+ assertEquals(Version.LUCENE_4_0, Version.parseLeniently("LUCENE_40"));
+ assertEquals(Version.LUCENE_4_0, Version.parseLeniently("LUCENE_4_0"));
assertEquals(Version.LUCENE_CURRENT, Version.parseLeniently("LUCENE_CURRENT"));
}
diff --git a/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java b/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java
index 92e213483c2..43816aad7fa 100644
--- a/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java
+++ b/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java
@@ -88,8 +88,8 @@ public class IndexFiles {
Directory dir = FSDirectory.open(new File(indexPath));
// :Post-Release-Update-Version.LUCENE_XY:
- Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_50);
- IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_50, analyzer);
+ Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_5_0);
+ IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_5_0, analyzer);
if (create) {
// Create a new index in the directory, removing any
diff --git a/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java b/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java
index 95b5975f4ec..9fa550e5e4d 100644
--- a/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java
+++ b/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java
@@ -92,7 +92,7 @@ public class SearchFiles {
IndexReader reader = DirectoryReader.open(FSDirectory.open(new File(index)));
IndexSearcher searcher = new IndexSearcher(reader);
// :Post-Release-Update-Version.LUCENE_XY:
- Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_50);
+ Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_5_0);
BufferedReader in = null;
if (queries != null) {
@@ -101,7 +101,7 @@ public class SearchFiles {
in = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
}
// :Post-Release-Update-Version.LUCENE_XY:
- QueryParser parser = new QueryParser(Version.LUCENE_50, field, analyzer);
+ QueryParser parser = new QueryParser(Version.LUCENE_5_0, field, analyzer);
while (true) {
if (queries == null && queryString == null) { // prompt the user
System.out.println("Enter query: ");
diff --git a/lucene/demo/src/java/org/apache/lucene/demo/facet/FacetExamples.java b/lucene/demo/src/java/org/apache/lucene/demo/facet/FacetExamples.java
index 2e4844c6a31..faf643cab49 100644
--- a/lucene/demo/src/java/org/apache/lucene/demo/facet/FacetExamples.java
+++ b/lucene/demo/src/java/org/apache/lucene/demo/facet/FacetExamples.java
@@ -28,6 +28,6 @@ public interface FacetExamples {
// :Post-Release-Update-Version.LUCENE_XY:
/** The Lucene {@link Version} used by the example code. */
- public static final Version EXAMPLES_VER = Version.LUCENE_50;
+ public static final Version EXAMPLES_VER = Version.LUCENE_5_0;
}
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
index 940cde4bc2f..5041c8d7cae 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
@@ -286,7 +286,7 @@ public class DirectoryTaxonomyWriter implements TaxonomyWriter {
// :Post-Release-Update-Version.LUCENE_XY:
// Make sure we use a MergePolicy which always merges adjacent segments and thus
// keeps the doc IDs ordered as well (this is crucial for the taxonomy index).
- return new IndexWriterConfig(Version.LUCENE_50, null).setOpenMode(openMode).setMergePolicy(
+ return new IndexWriterConfig(Version.LUCENE_5_0, null).setOpenMode(openMode).setMergePolicy(
new LogByteSizeMergePolicy());
}
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiAnalyzer.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiAnalyzer.java
index 97a981e6ac8..1fa596a8f4f 100644
--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiAnalyzer.java
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiAnalyzer.java
@@ -113,7 +113,7 @@ public class TestMultiAnalyzer extends BaseTokenStreamTestCase {
}
public void testPosIncrementAnalyzer() throws ParseException {
- QueryParser qp = new QueryParser(Version.LUCENE_40, "", new PosIncrementAnalyzer());
+ QueryParser qp = new QueryParser(Version.LUCENE_4_0, "", new PosIncrementAnalyzer());
assertEquals("quick brown", qp.parse("the quick brown").toString());
assertEquals("quick brown fox", qp.parse("the quick brown fox").toString());
}
diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
index 055b370a703..0cbf821436e 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
@@ -374,7 +374,7 @@ public abstract class LuceneTestCase extends Assert {
* Use this constant when creating Analyzers and any other version-dependent stuff.
* NOTE: Change this when development starts for new Lucene version:
*/
- public static final Version TEST_VERSION_CURRENT = Version.LUCENE_50;
+ public static final Version TEST_VERSION_CURRENT = Version.LUCENE_5_0;
/**
* True if and only if tests are run in verbose mode. If this flag is false
diff --git a/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/solrconfig.xml b/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/solrconfig.xml
index 9d9178746cf..e5bbb521ad6 100644
--- a/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/solrconfig.xml
+++ b/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/solrconfig.xml
@@ -35,7 +35,7 @@
that you fully re-index after changing this setting as it can
affect both how text is indexed and queried.
-->
- Farsi Range Queries
Collator collator = Collator.getInstance(new ULocale("ar"));
- ICUCollationKeyAnalyzer analyzer = new ICUCollationKeyAnalyzer(Version.LUCENE_50, collator);
+ ICUCollationKeyAnalyzer analyzer = new ICUCollationKeyAnalyzer(Version.LUCENE_5_0, collator);
RAMDirectory ramDir = new RAMDirectory();
- IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(Version.LUCENE_50, analyzer));
+ IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(Version.LUCENE_5_0, analyzer));
Document doc = new Document();
doc.add(new Field("content", "\u0633\u0627\u0628",
Field.Store.YES, Field.Index.ANALYZED));
@@ -125,7 +125,7 @@ algorithm.
writer.close();
IndexSearcher is = new IndexSearcher(ramDir, true);
- QueryParser aqp = new QueryParser(Version.LUCENE_50, "content", analyzer);
+ QueryParser aqp = new QueryParser(Version.LUCENE_5_0, "content", analyzer);
aqp.setAnalyzeRangeTerms(true);
// Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
@@ -141,9 +141,9 @@ algorithm.
Danish Sorting
Analyzer analyzer
- = new ICUCollationKeyAnalyzer(Version.LUCENE_50, Collator.getInstance(new ULocale("da", "dk")));
+ = new ICUCollationKeyAnalyzer(Version.LUCENE_5_0, Collator.getInstance(new ULocale("da", "dk")));
RAMDirectory indexStore = new RAMDirectory();
- IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(Version.LUCENE_50, analyzer));
+ IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(Version.LUCENE_5_0, analyzer));
String[] tracer = new String[] { "A", "B", "C", "D", "E" };
String[] data = new String[] { "HAT", "HUT", "H\u00C5T", "H\u00D8T", "HOT" };
String[] sortedTracerOrder = new String[] { "A", "E", "B", "D", "C" };
@@ -169,15 +169,15 @@ algorithm.
Collator collator = Collator.getInstance(new ULocale("tr", "TR"));
collator.setStrength(Collator.PRIMARY);
- Analyzer analyzer = new ICUCollationKeyAnalyzer(Version.LUCENE_50, collator);
+ Analyzer analyzer = new ICUCollationKeyAnalyzer(Version.LUCENE_5_0, collator);
RAMDirectory ramDir = new RAMDirectory();
- IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(Version.LUCENE_50, analyzer));
+ IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(Version.LUCENE_5_0, analyzer));
Document doc = new Document();
doc.add(new Field("contents", "DIGY", Field.Store.NO, Field.Index.ANALYZED));
writer.addDocument(doc);
writer.close();
IndexSearcher is = new IndexSearcher(ramDir, true);
- QueryParser parser = new QueryParser(Version.LUCENE_50, "contents", analyzer);
+ QueryParser parser = new QueryParser(Version.LUCENE_5_0, "contents", analyzer);
Query query = parser.parse("d\u0131gy"); // U+0131: dotless i
ScoreDoc[] result = is.search(query, null, 1000).scoreDocs;
assertEquals("The index Term should be included.", 1, result.length);
diff --git a/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java b/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java
index a3a5a8c3680..b83638fcb30 100644
--- a/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java
+++ b/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java
@@ -137,7 +137,7 @@ public final class SmartChineseAnalyzer extends Analyzer {
public TokenStreamComponents createComponents(String fieldName) {
final Tokenizer tokenizer;
TokenStream result;
- if (matchVersion.onOrAfter(Version.LUCENE_48)) {
+ if (matchVersion.onOrAfter(Version.LUCENE_4_8)) {
tokenizer = new HMMChineseTokenizer();
result = tokenizer;
} else {
diff --git a/lucene/benchmark/conf/addIndexes.alg b/lucene/benchmark/conf/addIndexes.alg
index 0aa4bfdc35b..01bb8f98dcd 100755
--- a/lucene/benchmark/conf/addIndexes.alg
+++ b/lucene/benchmark/conf/addIndexes.alg
@@ -15,7 +15,7 @@
# * limitations under the License.
# */
-writer.version=LUCENE_40
+writer.version=4.0
analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
directory=FSDirectory
diff --git a/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg b/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg
index 253b4517543..4f732597908 100644
--- a/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg
+++ b/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg
@@ -17,7 +17,7 @@
# -------------------------------------------------------------------------------------
# multi val params are iterated by NewRound's, added to reports, start with column name.
-writer.version=LUCENE_40
+writer.version=4.0
#merge.factor=mrg:10:100:10:100:10:100:10:100
#max.buffered=buf:10:10:100:100:10:10:100:100
ram.flush.mb=flush:32:40:48:56:32:40:48:56
diff --git a/lucene/benchmark/conf/indexing-flush-by-RAM.alg b/lucene/benchmark/conf/indexing-flush-by-RAM.alg
index 1f4169df52e..771a685cb24 100644
--- a/lucene/benchmark/conf/indexing-flush-by-RAM.alg
+++ b/lucene/benchmark/conf/indexing-flush-by-RAM.alg
@@ -17,7 +17,7 @@
# -------------------------------------------------------------------------------------
# multi val params are iterated by NewRound's, added to reports, start with column name.
-writer.version=LUCENE_40
+writer.version=4.0
#merge.factor=mrg:10:100:10:100:10:100:10:100
#max.buffered=buf:10:10:100:100:10:10:100:100
ram.flush.mb=flush:32:40:48:56:32:40:48:56
diff --git a/lucene/benchmark/conf/indexing-multithreaded.alg b/lucene/benchmark/conf/indexing-multithreaded.alg
index 2385022540e..a1685462d6b 100644
--- a/lucene/benchmark/conf/indexing-multithreaded.alg
+++ b/lucene/benchmark/conf/indexing-multithreaded.alg
@@ -17,7 +17,7 @@
# -------------------------------------------------------------------------------------
# multi val params are iterated by NewRound's, added to reports, start with column name.
-writer.version=LUCENE_40
+writer.version=4.0
merge.factor=mrg:10:100:10:100:10:100:10:100
max.buffered=buf:10:10:100:100:10:10:100:100
#ram.flush.mb=flush:32:40:48:56:32:40:48:56
diff --git a/lucene/benchmark/conf/indexing.alg b/lucene/benchmark/conf/indexing.alg
index f546b8b4a99..42c01f3e07e 100644
--- a/lucene/benchmark/conf/indexing.alg
+++ b/lucene/benchmark/conf/indexing.alg
@@ -17,7 +17,7 @@
# -------------------------------------------------------------------------------------
# multi val params are iterated by NewRound's, added to reports, start with column name.
-writer.version=LUCENE_40
+writer.version=4.0
merge.factor=mrg:10:100:10:100:10:100:10:100
max.buffered=buf:10:10:100:100:10:10:100:100
#ram.flush.mb=flush:32:40:48:56:32:40:48:56
diff --git a/lucene/benchmark/conf/standard.alg b/lucene/benchmark/conf/standard.alg
index 1fcc8e1a171..69cb56e3f3f 100644
--- a/lucene/benchmark/conf/standard.alg
+++ b/lucene/benchmark/conf/standard.alg
@@ -17,7 +17,7 @@
# -------------------------------------------------------------------------------------
# multi val params are iterated by NewRound's, added to reports, start with column name.
-writer.version=LUCENE_40
+writer.version=4.0
merge.factor=mrg:10:100:10:100:10:100:10:100
max.buffered=buf:10:10:100:100:10:10:100:100
compound=cmpnd:true:true:true:true:false:false:false:false
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AnalyzerFactoryTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AnalyzerFactoryTask.java
index 4a376ab3022..a78693a8dd5 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AnalyzerFactoryTask.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AnalyzerFactoryTask.java
@@ -68,7 +68,7 @@ import java.util.regex.Pattern;
* positionIncrementGap:100,
* HTMLStripCharFilter,
* MappingCharFilter(mapping:'mapping-FoldToASCII.txt'),
- * WhitespaceTokenizer(luceneMatchVersion:LUCENE_42),
+ * WhitespaceTokenizer(luceneMatchVersion:LUCENE_5_0),
* TokenLimitFilter(maxTokenCount:10000, consumeAllTokens:false))
* [...]
* -NewAnalyzer('strip html, fold to ascii, whitespace tokenize, max 10k tokens')
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
index 054895db31d..8ff264a723a 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
@@ -96,8 +96,8 @@ public class CreateIndexTask extends PerfTask {
}
public static IndexWriterConfig createWriterConfig(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit) {
- // :Post-Release-Update-Version.LUCENE_XY:
- Version version = Version.valueOf(config.get("writer.version", Version.LUCENE_50.toString()));
+ @SuppressWarnings("deprecation")
+ Version version = Version.parseLeniently(config.get("writer.version", Version.LUCENE_CURRENT.toString()));
IndexWriterConfig iwConf = new IndexWriterConfig(version, runData.getAnalyzer());
iwConf.setOpenMode(mode);
IndexDeletionPolicy indexDeletionPolicy = getIndexDeletionPolicy(config);
diff --git a/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTaskTest.java b/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTaskTest.java
index 4c1c8fd6285..8a8e485fc99 100644
--- a/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTaskTest.java
+++ b/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTaskTest.java
@@ -38,7 +38,7 @@ public class CreateIndexTaskTest extends BenchmarkTestCase {
private PerfRunData createPerfRunData(String infoStreamValue) throws Exception {
Properties props = new Properties();
// :Post-Release-Update-Version.LUCENE_XY:
- props.setProperty("writer.version", Version.LUCENE_50.toString());
+ props.setProperty("writer.version", Version.LUCENE_5_0.toString());
props.setProperty("print.props", "false"); // don't print anything
props.setProperty("directory", "RAMDirectory");
if (infoStreamValue != null) {
diff --git a/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java b/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
index 1d9424b974c..d487b5de8a3 100644
--- a/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
+++ b/lucene/classification/src/java/org/apache/lucene/classification/utils/DatasetSplitter.java
@@ -70,9 +70,9 @@ public class DatasetSplitter {
// create IWs for train / test / cv IDXs
// :Post-Release-Update-Version.LUCENE_XY:
- IndexWriter testWriter = new IndexWriter(testIndex, new IndexWriterConfig(Version.LUCENE_50, analyzer));
- IndexWriter cvWriter = new IndexWriter(crossValidationIndex, new IndexWriterConfig(Version.LUCENE_50, analyzer));
- IndexWriter trainingWriter = new IndexWriter(trainingIndex, new IndexWriterConfig(Version.LUCENE_50, analyzer));
+ IndexWriter testWriter = new IndexWriter(testIndex, new IndexWriterConfig(Version.LUCENE_5_0, analyzer));
+ IndexWriter cvWriter = new IndexWriter(crossValidationIndex, new IndexWriterConfig(Version.LUCENE_5_0, analyzer));
+ IndexWriter trainingWriter = new IndexWriter(trainingIndex, new IndexWriterConfig(Version.LUCENE_5_0, analyzer));
try {
int size = originalIndex.maxDoc();
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
index 5ddbb68a1ef..c64059c70e8 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -908,7 +908,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{
* If there are running merges or uncommitted
* changes:
*
- *
block in javadoc below)
/**
* Wraps a {@link RAMDirectory}
* around any provided delegate directory, to
@@ -50,7 +51,7 @@ import org.apache.lucene.util.IOUtils;
*
* Directory fsDir = FSDirectory.open(new File("/path/to/index"));
* NRTCachingDirectory cachedFSDir = new NRTCachingDirectory(fsDir, 5.0, 60.0);
- * IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_50, analyzer);
+ * IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_5_0, analyzer);
* IndexWriter writer = new IndexWriter(cachedFSDir, conf);
*
*
diff --git a/lucene/core/src/java/org/apache/lucene/util/Version.java b/lucene/core/src/java/org/apache/lucene/util/Version.java
index cd8f4979710..5bb70331101 100644
--- a/lucene/core/src/java/org/apache/lucene/util/Version.java
+++ b/lucene/core/src/java/org/apache/lucene/util/Version.java
@@ -38,77 +38,77 @@ public enum Version {
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_40,
+ LUCENE_4_0,
/**
* Match settings and bugs in Lucene's 4.1 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_41,
+ LUCENE_4_1,
/**
* Match settings and bugs in Lucene's 4.2 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_42,
+ LUCENE_4_2,
/**
* Match settings and bugs in Lucene's 4.3 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_43,
+ LUCENE_4_3,
/**
* Match settings and bugs in Lucene's 4.4 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_44,
+ LUCENE_4_4,
/**
* Match settings and bugs in Lucene's 4.5 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_45,
+ LUCENE_4_5,
/**
* Match settings and bugs in Lucene's 4.6 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_46,
+ LUCENE_4_6,
/**
* Match settings and bugs in Lucene's 4.7 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_47,
+ LUCENE_4_7,
/**
* Match settings and bugs in Lucene's 4.8 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_48,
+ LUCENE_4_8,
/**
* Match settings and bugs in Lucene's 4.9 release.
* @deprecated (5.0) Use latest
*/
@Deprecated
- LUCENE_49,
+ LUCENE_4_9,
/** Match settings and bugs in Lucene's 5.0 release.
*