diff --git a/build.xml b/build.xml
index 6076cdb9b5d..334061e66d1 100644
--- a/build.xml
+++ b/build.xml
@@ -35,6 +35,9 @@
+
+
+
+
diff --git a/src/java/org/apache/solr/core/Config.java b/src/java/org/apache/solr/core/Config.java
index f876168f852..8efae403c2e 100644
--- a/src/java/org/apache/solr/core/Config.java
+++ b/src/java/org/apache/solr/core/Config.java
@@ -284,16 +284,20 @@ public class Config {
private static final AtomicBoolean versionWarningAlreadyLogged = new AtomicBoolean(false);
- public static final Version parseLuceneVersionString(String matchVersion) {
- matchVersion = matchVersion.toUpperCase();
+ public static final Version parseLuceneVersionString(final String matchVersion) {
+ String parsedMatchVersion = matchVersion.toUpperCase();
+
+ // be lenient with the supplied version parameter
+ parsedMatchVersion = parsedMatchVersion.replaceFirst("^(\\d)\\.(\\d)$", "LUCENE_$1$2");
final Version version;
try {
- version = Version.valueOf(matchVersion);
+ version = Version.valueOf(parsedMatchVersion);
} catch (IllegalArgumentException iae) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Invalid luceneMatchVersion '" + matchVersion +
- "' property, valid values are: " + Arrays.toString(Version.values()), iae, false);
+ "', valid values are: " + Arrays.toString(Version.values()) +
+ " or a string in format 'V.V'", iae, false);
}
if (version == Version.LUCENE_CURRENT && !versionWarningAlreadyLogged.getAndSet(true)) {
diff --git a/src/test/org/apache/solr/analysis/BaseTokenTestCase.java b/src/test/org/apache/solr/analysis/BaseTokenTestCase.java
index 0bd6e209b3e..ec492e8a529 100644
--- a/src/test/org/apache/solr/analysis/BaseTokenTestCase.java
+++ b/src/test/org/apache/solr/analysis/BaseTokenTestCase.java
@@ -37,7 +37,7 @@ import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
public abstract class BaseTokenTestCase extends TestCase
{
protected static final Map DEFAULT_VERSION_PARAM =
- Collections.singletonMap("luceneMatchVersion", "LUCENE_30");
+ Collections.singletonMap("luceneMatchVersion", System.getProperty("tests.luceneMatchVersion", "LUCENE_CURRENT"));
// some helpers to test Analyzers and TokenStreams:
// these are taken from Lucene's BaseTokenStreamTestCase
diff --git a/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java b/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java
index d8be38d9b0e..f21a9295eff 100644
--- a/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java
+++ b/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java
@@ -20,6 +20,7 @@ import java.io.StringReader;
import java.lang.reflect.Field;
import org.apache.lucene.analysis.standard.StandardTokenizer;
+import org.apache.solr.core.Config;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.FieldType;
import org.apache.solr.util.AbstractSolrTestCase;
@@ -42,7 +43,9 @@ public class TestLuceneMatchVersion extends AbstractSolrTestCase {
return "solrconfig.xml";
}
- public static final Version DEFAULT_VERSION = Version.LUCENE_30;
+ // this must match the solrconfig.xml version for this test
+ public static final Version DEFAULT_VERSION =
+ Config.parseLuceneVersionString(System.getProperty("tests.luceneMatchVersion", "LUCENE_CURRENT"));
public void testStandardTokenizerVersions() throws Exception {
assertEquals(DEFAULT_VERSION, solrConfig.luceneMatchVersion);
diff --git a/src/test/test-files/solr/conf/schema-luceneMatchVersion.xml b/src/test/test-files/solr/conf/schema-luceneMatchVersion.xml
index 1feb665ebc5..bbd9948bb75 100644
--- a/src/test/test-files/solr/conf/schema-luceneMatchVersion.xml
+++ b/src/test/test-files/solr/conf/schema-luceneMatchVersion.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/src/test/test-files/solr/conf/solrconfig.xml b/src/test/test-files/solr/conf/solrconfig.xml
index be061d12dd6..ab3dd110ce4 100644
--- a/src/test/test-files/solr/conf/solrconfig.xml
+++ b/src/test/test-files/solr/conf/solrconfig.xml
@@ -45,7 +45,7 @@
not be changed if replication is in use. -->
${solr.data.dir:./solr/data}
- LUCENE_30
+ 3.1