You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/01/17 12:01:52 UTC

svn commit: r1059866 - /lucene/dev/trunk/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java

Author: rmuir
Date: Mon Jan 17 11:01:51 2011
New Revision: 1059866

URL: http://svn.apache.org/viewvc?rev=1059866&view=rev
Log:
SOLR-2259: warn if you are using a deprecated matchVersion constant

Modified:
    lucene/dev/trunk/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java?rev=1059866&r1=1059865&r2=1059866&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java Mon Jan 17 11:01:51 2011
@@ -30,6 +30,8 @@ import org.apache.lucene.analysis.core.S
 import org.apache.lucene.analysis.util.CharArraySet;
 import org.apache.lucene.util.Version;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Simple abstract implementation that handles init arg processing, is not really
@@ -45,6 +47,8 @@ abstract class BaseTokenStreamFactory {
   /** the luceneVersion arg */
   protected Version luceneMatchVersion = null;
 
+  public static final Logger log = LoggerFactory.getLogger(BaseTokenStreamFactory.class);
+
   public void init(Map<String,String> args) {
     this.args=args;
     String matchVersion = args.get(IndexSchema.LUCENE_MATCH_VERSION_PARAM);
@@ -64,6 +68,10 @@ abstract class BaseTokenStreamFactory {
     if (luceneMatchVersion == null) {
       throw new RuntimeException("Configuration Error: Factory '" + this.getClass().getName() +
         "' needs a 'luceneMatchVersion' parameter");
+    } else if (!luceneMatchVersion.onOrAfter(Version.LUCENE_40)) {
+      log.warn(getClass().getSimpleName() + " is using deprecated " + luceneMatchVersion + 
+        " emulation. You should at some point declare and reindex to at least 4.0, because " +
+        "3.x emulation is deprecated and will be removed in 5.0");
     }
   }