From 6e66286f9dc2f8af53b34d377be5b28ec27e420a Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 17 Jan 2011 11:01:51 +0000 Subject: [PATCH] SOLR-2259: warn if you are using a deprecated matchVersion constant git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1059866 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/analysis/BaseTokenStreamFactory.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java b/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java index ec9614f1a58..f2977a4d42e 100644 --- a/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java +++ b/solr/src/java/org/apache/solr/analysis/BaseTokenStreamFactory.java @@ -30,6 +30,8 @@ import org.apache.lucene.analysis.core.StopFilter; 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 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"); } }