diff options
author | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-07-22 17:36:18 +0200 |
---|---|---|
committer | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-07-23 15:34:05 +0200 |
commit | 2bfdf1eab621fadb516c1e5d10ca38c2b3390029 (patch) | |
tree | c4c061fcdf6573b48e60fa3cd51fb2e8d13be461 /server | |
parent | 1fd258f12f256aea2359d3469f9e6308608485f2 (diff) | |
download | sonarqube-2bfdf1eab621fadb516c1e5d10ca38c2b3390029.tar.gz sonarqube-2bfdf1eab621fadb516c1e5d10ca38c2b3390029.zip |
SONAR-4898 - Disable auto_start for JSW
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java b/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java index 28a60a430f9..c2c1b2bac96 100644 --- a/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java +++ b/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java @@ -63,6 +63,60 @@ public class ElasticSearch extends Process { } } + private void initAnalysis(ImmutableSettings.Builder esSettings) { + esSettings + .put("index.mapper.dynamic", false) + + // Sortable text analyzer + .put("index.analysis.analyzer.sortable.type", "custom") + .put("index.analysis.analyzer.sortable.tokenizer", "keyword") + .putArray("index.analysis.analyzer.sortable.filter", "trim", "lowercase", "truncate") + + // Edge NGram index-analyzer + .put("index.analysis.analyzer.index_grams.type", "custom") + .put("index.analysis.analyzer.index_grams.tokenizer", "whitespace") + .putArray("index.analysis.analyzer.index_grams.filter", "trim", "lowercase", "gram_filter") + + // Edge NGram search-analyzer + .put("index.analysis.analyzer.search_grams.type", "custom") + .put("index.analysis.analyzer.search_grams.tokenizer", "whitespace") + .putArray("index.analysis.analyzer.search_grams.filter", "trim", "lowercase") + + // Word index-analyzer + .put("index.analysis.analyzer.index_words.type", "custom") + .put("index.analysis.analyzer.index_words.tokenizer", "standard") + .putArray("index.analysis.analyzer.index_words.filter", + "standard", "word_filter", "lowercase", "stop", "asciifolding", "porter_stem") + + // Word search-analyzer + .put("index.analysis.analyzer.search_words.type", "custom") + .put("index.analysis.analyzer.search_words.tokenizer", "standard") + .putArray("index.analysis.analyzer.search_words.filter", + "standard", "lowercase", "stop", "asciifolding", "porter_stem") + + // Edge NGram filter + .put("index.analysis.filter.gram_filter.type", "edgeNGram") + .put("index.analysis.filter.gram_filter.min_gram", 2) + .put("index.analysis.filter.gram_filter.max_gram", 15) + .putArray("index.analysis.filter.gram_filter.token_chars", "letter", "digit", "punctuation", "symbol") + + // Word filter + .put("index.analysis.filter.word_filter.type", "word_delimiter") + .put("index.analysis.filter.word_filter.generate_word_parts", true) + .put("index.analysis.filter.word_filter.catenate_words", true) + .put("index.analysis.filter.word_filter.catenate_numbers", true) + .put("index.analysis.filter.word_filter.catenate_all", true) + .put("index.analysis.filter.word_filter.split_on_case_change", true) + .put("index.analysis.filter.word_filter.preserve_original", true) + .put("index.analysis.filter.word_filter.split_on_numerics", true) + .put("index.analysis.filter.word_filter.stem_english_possessive", true) + + // Path Analyzer + .put("index.analysis.analyzer.path_analyzer.type", "custom") + .put("index.analysis.analyzer.path_analyzer.tokenizer", "path_hierarchy"); + + } + @Override public void onStart() { String dataDir = props.of("sonar.path.data"); @@ -94,6 +148,8 @@ public class ElasticSearch extends Process { .put("transport.tcp.port", port) .put("path.data", new File(dataDir, "es").getAbsolutePath()); + initAnalysis(esSettings); + if (props.booleanOf(ES_DEBUG_PROPERTY, false)) { esSettings .put("http.enabled", true) |