mirror of https://github.com/apache/lucene.git
LUCENE-5900: Fix remaining issues with default matchVersion
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1651127 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d385c653c2
commit
0477667376
|
@ -48,7 +48,6 @@ public class DictionaryCompoundWordTokenFilterFactory extends TokenFilterFactory
|
|||
/** Creates a new DictionaryCompoundWordTokenFilterFactory */
|
||||
public DictionaryCompoundWordTokenFilterFactory(Map<String, String> args) {
|
||||
super(args);
|
||||
assureMatchVersion();
|
||||
dictFile = require(args, "dictionary");
|
||||
minWordSize = getInt(args, "minWordSize", CompoundWordTokenFilterBase.DEFAULT_MIN_WORD_SIZE);
|
||||
minSubwordSize = getInt(args, "minSubwordSize", CompoundWordTokenFilterBase.DEFAULT_MIN_SUBWORD_SIZE);
|
||||
|
|
|
@ -74,7 +74,6 @@ public class HyphenationCompoundWordTokenFilterFactory extends TokenFilterFactor
|
|||
/** Creates a new HyphenationCompoundWordTokenFilterFactory */
|
||||
public HyphenationCompoundWordTokenFilterFactory(Map<String, String> args) {
|
||||
super(args);
|
||||
assureMatchVersion();
|
||||
dictFile = get(args, "dictionary");
|
||||
encoding = get(args, "encoding");
|
||||
hypFile = require(args, "hyphenator");
|
||||
|
|
|
@ -78,7 +78,6 @@ public class CapitalizationFilterFactory extends TokenFilterFactory {
|
|||
/** Creates a new CapitalizationFilterFactory */
|
||||
public CapitalizationFilterFactory(Map<String, String> args) {
|
||||
super(args);
|
||||
assureMatchVersion();
|
||||
boolean ignoreCase = getBoolean(args, KEEP_IGNORE_CASE, false);
|
||||
Set<String> k = getSet(args, KEEP);
|
||||
if (k != null) {
|
||||
|
|
|
@ -55,7 +55,6 @@ public class StemmerOverrideFilterFactory extends TokenFilterFactory implements
|
|||
@Override
|
||||
public void inform(ResourceLoader loader) throws IOException {
|
||||
if (dictionaryFiles != null) {
|
||||
assureMatchVersion();
|
||||
List<String> files = splitFileNames(dictionaryFiles);
|
||||
if (files.size() > 0) {
|
||||
StemmerOverrideFilter.Builder builder = new StemmerOverrideFilter.Builder(ignoreCase);
|
||||
|
|
|
@ -63,7 +63,6 @@ public class WordDelimiterFilterFactory extends TokenFilterFactory implements Re
|
|||
/** Creates a new WordDelimiterFilterFactory */
|
||||
public WordDelimiterFilterFactory(Map<String, String> args) {
|
||||
super(args);
|
||||
assureMatchVersion();
|
||||
int flags = 0;
|
||||
if (getInt(args, "generateWordParts", 1) != 0) {
|
||||
flags |= GENERATE_WORD_PARTS;
|
||||
|
|
|
@ -102,7 +102,6 @@ public class SynonymFilterFactory extends TokenFilterFactory implements Resource
|
|||
}
|
||||
|
||||
if (tokenizerFactory != null) {
|
||||
assureMatchVersion();
|
||||
tokArgs.put("luceneMatchVersion", getLuceneMatchVersion().toString());
|
||||
for (Iterator<String> itr = args.keySet().iterator(); itr.hasNext();) {
|
||||
String key = itr.next();
|
||||
|
|
|
@ -70,7 +70,7 @@ public abstract class AbstractAnalysisFactory {
|
|||
originalArgs = Collections.unmodifiableMap(new HashMap<>(args));
|
||||
String version = get(args, LUCENE_MATCH_VERSION_PARAM);
|
||||
if (version == null) {
|
||||
luceneMatchVersion = null;
|
||||
luceneMatchVersion = Version.LATEST;
|
||||
} else {
|
||||
try {
|
||||
luceneMatchVersion = Version.parseLeniently(version);
|
||||
|
@ -85,16 +85,6 @@ public abstract class AbstractAnalysisFactory {
|
|||
return originalArgs;
|
||||
}
|
||||
|
||||
/** this method can be called in the {@link org.apache.lucene.analysis.util.TokenizerFactory#create()}
|
||||
* or {@link org.apache.lucene.analysis.util.TokenFilterFactory#create(org.apache.lucene.analysis.TokenStream)} methods,
|
||||
* to inform user, that for this factory a {@link #luceneMatchVersion} is required */
|
||||
protected final void assureMatchVersion() {
|
||||
if (luceneMatchVersion == null) {
|
||||
throw new IllegalArgumentException("Configuration Error: Factory '" + this.getClass().getName() +
|
||||
"' needs a 'luceneMatchVersion' parameter");
|
||||
}
|
||||
}
|
||||
|
||||
public final Version getLuceneMatchVersion() {
|
||||
return this.luceneMatchVersion;
|
||||
}
|
||||
|
@ -241,7 +231,6 @@ public abstract class AbstractAnalysisFactory {
|
|||
*/
|
||||
protected final CharArraySet getWordSet(ResourceLoader loader,
|
||||
String wordFiles, boolean ignoreCase) throws IOException {
|
||||
assureMatchVersion();
|
||||
List<String> files = splitFileNames(wordFiles);
|
||||
CharArraySet words = null;
|
||||
if (files.size() > 0) {
|
||||
|
@ -267,7 +256,6 @@ public abstract class AbstractAnalysisFactory {
|
|||
* except the input is in snowball format. */
|
||||
protected final CharArraySet getSnowballWordSet(ResourceLoader loader,
|
||||
String wordFiles, boolean ignoreCase) throws IOException {
|
||||
assureMatchVersion();
|
||||
List<String> files = splitFileNames(wordFiles);
|
||||
CharArraySet words = null;
|
||||
if (files.size() > 0) {
|
||||
|
|
Loading…
Reference in New Issue