From 37d02505aa9b0e2fa70d1939f0518a23fb271e54 Mon Sep 17 00:00:00 2001 From: Jim Ferenczi Date: Fri, 22 Jan 2016 14:30:32 +0100 Subject: [PATCH] Covers Simon's comments --- .../elasticsearch/indices/analysis/HunspellService.java | 9 ++------- .../indices/cache/request/IndicesRequestCache.java | 4 ++-- .../indices/fielddata/cache/IndicesFieldDataCache.java | 1 - 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java b/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java index 429dc5614c4..f99b39ef620 100644 --- a/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java +++ b/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java @@ -74,7 +74,6 @@ public class HunspellService extends AbstractComponent { public final static Setting HUNSPELL_LAZY_LOAD = Setting.boolSetting("indices.analysis.hunspell.dictionary.lazy", Boolean.FALSE, false, Setting.Scope.CLUSTER); public final static Setting HUNSPELL_IGNORE_CASE = Setting.boolSetting("indices.analysis.hunspell.dictionary.ignore_case", Boolean.FALSE, false, Setting.Scope.CLUSTER); public final static Setting HUNSPELL_DICTIONARY_OPTIONS = Setting.groupSetting("indices.analysis.hunspell.dictionary.", false, Setting.Scope.CLUSTER); - private final static String OLD_HUNSPELL_LOCATION = "indices.analysis.hunspell.dictionary.location"; private final ConcurrentHashMap dictionaries = new ConcurrentHashMap<>(); private final Map knownDictionaries; private final boolean defaultIgnoreCase; @@ -84,7 +83,7 @@ public class HunspellService extends AbstractComponent { public HunspellService(final Settings settings, final Environment env, final Map knownDictionaries) throws IOException { super(settings); this.knownDictionaries = Collections.unmodifiableMap(knownDictionaries); - this.hunspellDir = resolveHunspellDirectory(settings, env); + this.hunspellDir = resolveHunspellDirectory(env); this.defaultIgnoreCase = HUNSPELL_IGNORE_CASE.get(settings); this.loadingFunction = (locale) -> { try { @@ -112,11 +111,7 @@ public class HunspellService extends AbstractComponent { return dictionary; } - private Path resolveHunspellDirectory(Settings settings, Environment env) { - String location = settings.get(OLD_HUNSPELL_LOCATION, null); - if (location != null) { - throw new IllegalArgumentException("please, put your hunspell dictionaries under config/hunspell !"); - } + private Path resolveHunspellDirectory(Environment env) { return env.configFile().resolve("hunspell"); } diff --git a/core/src/main/java/org/elasticsearch/indices/cache/request/IndicesRequestCache.java b/core/src/main/java/org/elasticsearch/indices/cache/request/IndicesRequestCache.java index 57ece4045d1..3cdb637d370 100644 --- a/core/src/main/java/org/elasticsearch/indices/cache/request/IndicesRequestCache.java +++ b/core/src/main/java/org/elasticsearch/indices/cache/request/IndicesRequestCache.java @@ -81,7 +81,7 @@ public class IndicesRequestCache extends AbstractComponent implements RemovalLis * since we are checking on the cluster state IndexMetaData always. */ public static final Setting INDEX_CACHE_REQUEST_ENABLED_SETTING = Setting.boolSetting("index.requests.cache.enable", true, true, Setting.Scope.INDEX); - public static final Setting INDICES_CACHE_REQUEST_CLEAN_INTERVAL = Setting.positiveTimeSetting("indices.requests.cache.clean_interval", new TimeValue(0), false, Setting.Scope.CLUSTER); + public static final Setting INDICES_CACHE_REQUEST_CLEAN_INTERVAL = Setting.positiveTimeSetting("indices.requests.cache.clean_interval", TimeValue.timeValueSeconds(60), false, Setting.Scope.CLUSTER); public static final Setting INDICES_CACHE_QUERY_SIZE = Setting.byteSizeSetting("indices.requests.cache.size", "1%", false, Setting.Scope.CLUSTER); public static final Setting INDICES_CACHE_QUERY_EXPIRE = Setting.positiveTimeSetting("indices.requests.cache.expire", new TimeValue(0), false, Setting.Scope.CLUSTER); @@ -109,7 +109,7 @@ public class IndicesRequestCache extends AbstractComponent implements RemovalLis super(settings); this.clusterService = clusterService; this.threadPool = threadPool; - this.cleanInterval = settings.getAsTime(INDICES_CACHE_REQUEST_CLEAN_INTERVAL.getKey(), TimeValue.timeValueSeconds(60)); + this.cleanInterval = INDICES_CACHE_REQUEST_CLEAN_INTERVAL.get(settings); this.size = INDICES_CACHE_QUERY_SIZE.get(settings); diff --git a/core/src/main/java/org/elasticsearch/indices/fielddata/cache/IndicesFieldDataCache.java b/core/src/main/java/org/elasticsearch/indices/fielddata/cache/IndicesFieldDataCache.java index 57e8cc8974d..06d4c219208 100644 --- a/core/src/main/java/org/elasticsearch/indices/fielddata/cache/IndicesFieldDataCache.java +++ b/core/src/main/java/org/elasticsearch/indices/fielddata/cache/IndicesFieldDataCache.java @@ -76,7 +76,6 @@ public class IndicesFieldDataCache extends AbstractComponent implements RemovalL cacheBuilder.setMaximumWeight(sizeInBytes).weigher(new FieldDataWeigher()); } - logger.debug("using size [{}]", new ByteSizeValue(sizeInBytes)); cache = cacheBuilder.build(); this.cleanInterval = INDICES_FIELDDATA_CLEAN_INTERVAL_SETTING.get(settings);