mirror of https://github.com/apache/lucene.git
SOLR-2259: warn if you are using a deprecated analysis factory
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1060023 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6a53e4b75c
commit
aed4a3972d
|
@ -19,6 +19,7 @@ package org.apache.solr.analysis;
|
|||
import org.apache.lucene.analysis.ar.ArabicLetterTokenizer;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -28,8 +29,13 @@ import java.io.Reader;
|
|||
@Deprecated
|
||||
public class ArabicLetterTokenizerFactory extends BaseTokenizerFactory{
|
||||
|
||||
public ArabicLetterTokenizer create(Reader input) {
|
||||
public void init(Map<String,String> args) {
|
||||
super.init(args);
|
||||
assureMatchVersion();
|
||||
warnDeprecated("Use StandardTokenizerFactory instead.");
|
||||
}
|
||||
|
||||
public ArabicLetterTokenizer create(Reader input) {
|
||||
return new ArabicLetterTokenizer(luceneMatchVersion, input);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,6 +75,10 @@ abstract class BaseTokenStreamFactory {
|
|||
}
|
||||
}
|
||||
|
||||
protected final void warnDeprecated(String message) {
|
||||
log.warn(getClass().getSimpleName() + " is deprecated. " + message);
|
||||
}
|
||||
|
||||
// TODO: move these somewhere that tokenizers and others
|
||||
// can also use them...
|
||||
protected int getInt(String name) {
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
|
||||
package org.apache.solr.analysis;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.analysis.cn.ChineseFilter;
|
||||
|
||||
|
@ -27,6 +29,11 @@ import org.apache.lucene.analysis.cn.ChineseFilter;
|
|||
*/
|
||||
@Deprecated
|
||||
public class ChineseFilterFactory extends BaseTokenFilterFactory {
|
||||
public void init(Map<String,String> args) {
|
||||
super.init(args);
|
||||
warnDeprecated("Use StopFilterFactory instead.");
|
||||
}
|
||||
|
||||
public ChineseFilter create(TokenStream in) {
|
||||
return new ChineseFilter(in);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
package org.apache.solr.analysis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.lucene.analysis.cn.ChineseTokenizer;
|
||||
|
||||
/**
|
||||
|
@ -28,6 +30,11 @@ import org.apache.lucene.analysis.cn.ChineseTokenizer;
|
|||
*/
|
||||
@Deprecated
|
||||
public class ChineseTokenizerFactory extends BaseTokenizerFactory {
|
||||
public void init(Map<String,String> args) {
|
||||
super.init(args);
|
||||
warnDeprecated("Use StandardTokenizerFactory instead.");
|
||||
}
|
||||
|
||||
public ChineseTokenizer create(Reader in) {
|
||||
return new ChineseTokenizer(in);
|
||||
}
|
||||
|
|
|
@ -37,10 +37,11 @@ public class RussianLetterTokenizerFactory extends BaseTokenizerFactory {
|
|||
throw new SolrException(ErrorCode.SERVER_ERROR,
|
||||
"The charset parameter is no longer supported. "
|
||||
+ "Please process your documents as Unicode instead.");
|
||||
assureMatchVersion();
|
||||
warnDeprecated("Use StandardTokenizerFactory instead.");
|
||||
}
|
||||
|
||||
public RussianLetterTokenizer create(Reader in) {
|
||||
assureMatchVersion();
|
||||
return new RussianLetterTokenizer(luceneMatchVersion,in);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue