]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11792 change default max_ngram_diff to 13
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 11 Mar 2019 14:42:11 +0000 (15:42 +0100)
committerSonarTech <sonartech@sonarsource.com>
Tue, 19 Mar 2019 19:21:25 +0000 (20:21 +0100)
server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java
server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java

index 84c50d634878c8a4a72c974da86877e1ac1fc54f..3b47514f6cfc1d4ec1b07d187d6c56286e0762bc 100644 (file)
@@ -65,6 +65,7 @@ public abstract class NewIndex<T extends NewIndex<T>> {
 
     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() {
index 4db0c2b9be45f43285a97e9f4f3b8b91df2b31ad..835fe681d4ce9afd38deb3eeffb946c65160d0a3 100644 (file)
@@ -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