SOLR-1410: warn if deprecated charset option is used in greek and russian analysis factories

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@812760 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2009-09-09 03:58:12 +00:00
parent ab5c9889b9
commit a9ac376937
6 changed files with 48 additions and 7 deletions

View File

@ -50,6 +50,14 @@ information, see SOLR-1377.
If spellcheck.extendedResults=true, the response format for suggestions If spellcheck.extendedResults=true, the response format for suggestions
has changed, see SOLR-1071. has changed, see SOLR-1071.
Use of the "charset" option when configuring the following Analysis
Factories has been deprecated and will cause a warning to be logged.
In future versions of Solr attempting to use this option will cause an
error. See SOLR-1410 for more information.
* GreekLowerCaseFilterFactory
* RussianStemFilterFactory
* RussianLowerCaseFilterFactory
* RussianLetterTokenizerFactory
Versions of Major Components Versions of Major Components
---------------------------- ----------------------------
@ -660,12 +668,17 @@ Other Changes
44. Upgraded to Lucene 2.9-dev r801856 (Mark Miller) 44. Upgraded to Lucene 2.9-dev r801856 (Mark Miller)
45. SOLR1276: Added StatsComponentTest (Rafał Kuć, gsingers) 45. SOLR1276: Added StatsComponentTest (Rafa<EFBFBD>Å Ku<4B>ć, gsingers)
46. SOLR-1377: The TokenizerFactory API has changed to explicitly return a Tokenizer 46. SOLR-1377: The TokenizerFactory API has changed to explicitly return a Tokenizer
rather then a TokenStream (that may be or may not be a Tokenizer). This change rather then a TokenStream (that may be or may not be a Tokenizer). This change
is required to take advantage of the Token reuse improvements in lucene 2.9. (ryan) is required to take advantage of the Token reuse improvements in lucene 2.9. (ryan)
47. SOLR-1410: Log a warning if the deprecated charset option is used
on GreekLowerCaseFilterFactory, RussianStemFilterFactory,
RussianLowerCaseFilterFactory or RussianLetterTokenizerFactory.
(Robert Muir via hossman)
Build Build
---------------------- ----------------------
@ -683,7 +696,7 @@ Build
Documentation Documentation
---------------------- ----------------------
1. SOLR-789: The javadoc of RandomSortField is not readable (Nicolas Lalevée via koji) 1. SOLR-789: The javadoc of RandomSortField is not readable (Nicolas Lalev<EFBFBD>Ã<EFBFBD>©e via koji)
2. SOLR-962: Note about null handling in ModifiableSolrParams.add javadoc 2. SOLR-962: Note about null handling in ModifiableSolrParams.add javadoc
(Kay Kay via hossman) (Kay Kay via hossman)
@ -1122,7 +1135,7 @@ Bug Fixes
9. SOLR-294: Logging of elapsed time broken on Solaris because the date command 9. SOLR-294: Logging of elapsed time broken on Solaris because the date command
there does not support the %s output format. (bill) there does not support the %s output format. (bill)
10. SOLR-136: Snappuller - "date -d" and locales don't mix. (Jürgen Hermann via bill) 10. SOLR-136: Snappuller - "date -d" and locales don't mix. (J<EFBFBD>Ã<EFBFBD>¼rgen Hermann via bill)
11. SOLR-333: Changed distributiondump.jsp to use Solr HOME instead of CWD to set path. 11. SOLR-333: Changed distributiondump.jsp to use Solr HOME instead of CWD to set path.

View File

@ -27,9 +27,12 @@ import org.apache.lucene.analysis.el.GreekCharsets;
import org.apache.lucene.analysis.el.GreekLowerCaseFilter; import org.apache.lucene.analysis.el.GreekLowerCaseFilter;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode; import org.apache.solr.common.SolrException.ErrorCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class GreekLowerCaseFilterFactory extends BaseTokenFilterFactory public class GreekLowerCaseFilterFactory extends BaseTokenFilterFactory
{ {
@Deprecated
private static Map<String,char[]> CHARSETS = new HashMap<String,char[]>(); private static Map<String,char[]> CHARSETS = new HashMap<String,char[]>();
static { static {
CHARSETS.put("UnicodeGreek",GreekCharsets.UnicodeGreek); CHARSETS.put("UnicodeGreek",GreekCharsets.UnicodeGreek);
@ -39,12 +42,23 @@ public class GreekLowerCaseFilterFactory extends BaseTokenFilterFactory
private char[] charset = GreekCharsets.UnicodeGreek; private char[] charset = GreekCharsets.UnicodeGreek;
private static Logger logger = LoggerFactory.getLogger(GreekLowerCaseFilterFactory.class);
@Override @Override
public void init(Map<String, String> args) { public void init(Map<String, String> args) {
super.init(args); super.init(args);
String charsetName = args.get("charset"); String charsetName = args.get("charset");
if (null != charsetName) charset = CHARSETS.get(charsetName); if (null != charsetName) {
charset = CHARSETS.get(charsetName);
if (charset.equals(GreekCharsets.UnicodeGreek))
logger.warn("Specifying UnicodeGreek is no longer required (default). "
+ "Use of the charset parameter will cause an error in Solr 1.5");
else
logger.warn("Support for this custom encoding is deprecated. "
+ "Use of the charset parameter will cause an error in Solr 1.5");
} else {
charset = GreekCharsets.UnicodeGreek; /* default to unicode */
}
if (null == charset) { if (null == charset) {
throw new SolrException(ErrorCode.SERVER_ERROR, throw new SolrException(ErrorCode.SERVER_ERROR,
"Don't understand charset: " + charsetName); "Don't understand charset: " + charsetName);

View File

@ -23,8 +23,14 @@ import java.util.HashMap;
import org.apache.solr.core.SolrConfig; import org.apache.solr.core.SolrConfig;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode; import org.apache.solr.common.SolrException.ErrorCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Deprecated
public class RussianCommon { public class RussianCommon {
private static Logger logger = LoggerFactory.getLogger(RussianCommon.class);
private static Map<String,char[]> CHARSETS = new HashMap<String,char[]>(); private static Map<String,char[]> CHARSETS = new HashMap<String,char[]>();
static { static {
CHARSETS.put("UnicodeRussian",RussianCharsets.UnicodeRussian); CHARSETS.put("UnicodeRussian",RussianCharsets.UnicodeRussian);
@ -37,6 +43,14 @@ public class RussianCommon {
return RussianCharsets.UnicodeRussian; return RussianCharsets.UnicodeRussian;
char[] charset = CHARSETS.get(name); char[] charset = CHARSETS.get(name);
if (charset.equals(RussianCharsets.UnicodeRussian))
logger.warn("Specifying UnicodeRussian is no longer required (default). "
+ "Use of the charset parameter will cause an error in Solr 1.5");
else
logger.warn("Support for this custom encoding is deprecated. "
+ "Use of the charset parameter will cause an error in Solr 1.5");
if (null == charset) { if (null == charset) {
throw new SolrException(ErrorCode.SERVER_ERROR, throw new SolrException(ErrorCode.SERVER_ERROR,
"Don't understand charset: " + name); "Don't understand charset: " + name);

View File

@ -23,7 +23,7 @@ import java.util.Map;
import org.apache.lucene.analysis.ru.RussianLetterTokenizer; import org.apache.lucene.analysis.ru.RussianLetterTokenizer;
public class RussianLetterTokenizerFactory extends BaseTokenizerFactory { public class RussianLetterTokenizerFactory extends BaseTokenizerFactory {
@Deprecated
private char[] charset; private char[] charset;
@Override @Override

View File

@ -23,7 +23,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.ru.RussianLowerCaseFilter; import org.apache.lucene.analysis.ru.RussianLowerCaseFilter;
public class RussianLowerCaseFilterFactory extends BaseTokenFilterFactory { public class RussianLowerCaseFilterFactory extends BaseTokenFilterFactory {
@Deprecated
private char[] charset; private char[] charset;
@Override @Override

View File

@ -25,7 +25,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.ru.RussianStemFilter; import org.apache.lucene.analysis.ru.RussianStemFilter;
public class RussianStemFilterFactory extends BaseTokenFilterFactory { public class RussianStemFilterFactory extends BaseTokenFilterFactory {
@Deprecated
private char[] charset; private char[] charset;
public void init(Map<String, String> args) { public void init(Map<String, String> args) {