From: Sébastien Lesaint Date: Mon, 11 Mar 2019 14:42:11 +0000 (+0100) Subject: SONAR-11792 change default max_ngram_diff to 13 X-Git-Tag: 7.7~27 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4112b9f541ac22cdc8153896ebf3213af39c1ef0;p=sonarqube.git SONAR-11792 change default max_ngram_diff to 13 --- diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java index 84c50d63487..3b47514f6cf 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java @@ -65,6 +65,7 @@ public abstract class NewIndex> { settings.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, shards); settings.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, replicas); + settings.put("index.max_ngram_diff", DefaultIndexSettings.MAXIMUM_NGRAM_LENGTH - DefaultIndexSettings.MINIMUM_NGRAM_LENGTH); } private void configureDefaultAttributes() { diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java index 4db0c2b9be4..835fe681d4c 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java @@ -84,6 +84,7 @@ public class NewIndexTest { assertThat(underTest.get("mapping.single_type")).isNull(); assertThat(underTest.get("index.number_of_shards")).isEqualTo("1"); assertThat(underTest.get("index.number_of_replicas")).isEqualTo("0"); + assertThat(underTest.get("index.max_ngram_diff")).isEqualTo("13"); } @Test @@ -100,6 +101,7 @@ public class NewIndexTest { assertThat(underTest.get("mapping.single_type")).isNull(); assertThat(underTest.get("index.number_of_shards")).isEqualTo("1"); assertThat(underTest.get("index.number_of_replicas")).isEqualTo("1"); + assertThat(underTest.get("index.max_ngram_diff")).isEqualTo("13"); } @Test