From 1cadfd747925d527ad239bb0fd4742cab19f20e8 Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Tue, 17 Oct 2017 15:01:39 +0200 Subject: [PATCH] Fix quality flaws --- .../org/sonar/server/es/DefaultIndexSettings.java | 2 ++ .../main/java/org/sonar/server/es/NewIndex.java | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/DefaultIndexSettings.java b/server/sonar-server/src/main/java/org/sonar/server/es/DefaultIndexSettings.java index 8bb2aa2b658..587c6a77178 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/DefaultIndexSettings.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/DefaultIndexSettings.java @@ -49,6 +49,8 @@ public class DefaultIndexSettings { public static final String INDEX_NOT_SEARCHABLE = "false"; public static final String FIELD_TYPE_TEXT = "text"; public static final String FIELD_TYPE_KEYWORD = "keyword"; + public static final String NORMS = "norms"; + public static final String STORE = "store"; public static final String FIELD_FIELDDATA = "fielddata"; public static final String FIELDDATA_ENABLED = "true"; public static final String FIELD_TERM_VECTOR = "term_vector"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java b/server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java index 13701a250e4..169b8284c75 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java @@ -49,6 +49,8 @@ import static org.sonar.server.es.DefaultIndexSettings.FIELD_TYPE_TEXT; import static org.sonar.server.es.DefaultIndexSettings.INDEX; import static org.sonar.server.es.DefaultIndexSettings.INDEX_NOT_SEARCHABLE; import static org.sonar.server.es.DefaultIndexSettings.INDEX_SEARCHABLE; +import static org.sonar.server.es.DefaultIndexSettings.NORMS; +import static org.sonar.server.es.DefaultIndexSettings.STORE; import static org.sonar.server.es.DefaultIndexSettings.TYPE; import static org.sonar.server.es.DefaultIndexSettingsElement.UUID_MODULE_ANALYZER; @@ -358,8 +360,8 @@ public class NewIndex { Map hash = new TreeMap<>(); hash.put("type", getFieldType()); hash.put(INDEX, disableSearch ? INDEX_NOT_SEARCHABLE : INDEX_SEARCHABLE); - hash.put("norms", valueOf(!disableNorms)); - hash.put("store", valueOf(store)); + hash.put(NORMS, valueOf(!disableNorms)); + hash.put(STORE, valueOf(store)); if (FIELD_TYPE_KEYWORD.equals(getFieldType())) { hash.put("doc_values", valueOf(!disabledDocValues)); } @@ -373,8 +375,8 @@ public class NewIndex { Map hash = new TreeMap<>(); hash.put("type", getFieldType()); hash.put(INDEX, disableSearch ? INDEX_NOT_SEARCHABLE : INDEX_SEARCHABLE); - hash.put("norms", "false"); - hash.put("store", valueOf(store)); + hash.put(NORMS, "false"); + hash.put(STORE, valueOf(store)); if (FIELD_TYPE_KEYWORD.equals(getFieldType())) { hash.put("doc_values", valueOf(!disabledDocValues)); } @@ -404,8 +406,8 @@ public class NewIndex { private Map configureSubField(Map subFieldMapping) { Map subHash = new TreeMap<>(subFieldMapping); subHash.put(INDEX, INDEX_SEARCHABLE); - subHash.put("norms", "false"); - subHash.put("store", valueOf(store)); + subHash.put(NORMS, "false"); + subHash.put(STORE, valueOf(store)); if (termVectorWithPositionOffsets) { subHash.put(FIELD_TERM_VECTOR, "with_positions_offsets"); } -- 2.39.5