Fix icu IndexScope setting

This commit is contained in:
Xu Zhang 2016-04-22 14:44:42 -07:00
parent d56d8b03c8
commit 3e4b470f83
2 changed files with 1 additions and 13 deletions

View File

@ -29,7 +29,6 @@ import org.apache.lucene.analysis.icu.segmentation.DefaultICUTokenizerConfig;
import org.apache.lucene.analysis.icu.segmentation.ICUTokenizer;
import org.apache.lucene.analysis.icu.segmentation.ICUTokenizerConfig;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
@ -37,11 +36,8 @@ import org.elasticsearch.index.IndexSettings;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -52,9 +48,6 @@ public class IcuTokenizerFactory extends AbstractTokenizerFactory {
private final ICUTokenizerConfig config;
private static final String RULE_FILES = "rule_files";
public static final Setting<List<String>> SETTING_RULE_FILES =
Setting.listSetting(RULE_FILES, Collections.emptyList(), Function.identity(), Setting.Property.IndexScope);
public IcuTokenizerFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
super(indexSettings, name, settings);
config = getIcuConfig(environment, settings);
@ -73,7 +66,7 @@ public class IcuTokenizerFactory extends AbstractTokenizerFactory {
Map<Integer, String> tailored = new HashMap<>();
try {
List<String> ruleFiles = SETTING_RULE_FILES.get(settings);
String[] ruleFiles = settings.getAsArray(RULE_FILES);
for (String scriptAndResourcePath : ruleFiles) {
int colonPos = scriptAndResourcePath.indexOf(":");

View File

@ -19,7 +19,6 @@
package org.elasticsearch.plugin.analysis.icu;
import org.elasticsearch.common.settings.SettingsModule;
import org.elasticsearch.index.analysis.IcuCollationTokenFilterFactory;
import org.elasticsearch.index.analysis.IcuFoldingTokenFilterFactory;
import org.elasticsearch.index.analysis.IcuNormalizerCharFilterFactory;
@ -55,8 +54,4 @@ public class AnalysisICUPlugin extends Plugin {
module.registerTokenFilter("icu_collation", IcuCollationTokenFilterFactory::new);
module.registerTokenFilter("icu_transform", IcuTransformTokenFilterFactory::new);
}
public void onModule(SettingsModule settingsModule) {
settingsModule.registerSetting(IcuTokenizerFactory.SETTING_RULE_FILES);
}
}