]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8798 make MetaIndex.value stored to be able to retrieve it
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 13 Jul 2017 14:01:33 +0000 (16:01 +0200)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 9 Aug 2017 13:09:54 +0000 (15:09 +0200)
server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java
server/sonar-server/src/main/java/org/sonar/server/es/metadata/MetadataIndexDefinition.java

index 420718052085fd8b0fec9bbbe5bed9a77410c0a6..de4e4377b9863adbfb38c805d690c48e607a591c 100644 (file)
@@ -203,6 +203,7 @@ public class NewIndex {
     private boolean disableNorms = false;
     private boolean termVectorWithPositionOffsets = false;
     private SortedMap<String, Object> subFields = Maps.newTreeMap();
+    private boolean store = false;
 
     private KeywordFieldBuilder(NewIndexType indexType, String fieldName) {
       this.indexType = indexType;
@@ -256,13 +257,19 @@ public class NewIndex {
       return this;
     }
 
+    public KeywordFieldBuilder store() {
+      this.store = true;
+      return this;
+    }
+
     public NewIndexType build() {
       Map<String, Object> hash = new TreeMap<>();
       if (subFields.isEmpty()) {
         hash.putAll(ImmutableMap.of(
             "type", FIELD_TYPE_KEYWORD,
             "index", disableSearch ? INDEX_NOT_SEARCHABLE : INDEX_SEARCHABLE,
-            "norms", String.valueOf(!disableNorms)));
+            "norms", String.valueOf(!disableNorms),
+            "store", String.valueOf(store)));
       } else {
         hash.put("type", "multi_field");
 
@@ -283,7 +290,8 @@ public class NewIndex {
         multiFields.put(fieldName, ImmutableMap.of(
             "type", FIELD_TYPE_KEYWORD,
             "index", INDEX_SEARCHABLE,
-            "norms", "false"
+            "norms", "false",
+            "store", String.valueOf(store)
         ));
 
         hash.put("fields", multiFields);
index bdffcf6b5eb881c8f71d64ed48f570799927b85a..4eb744e5b5924407fe97aad02d3cdc0add6fe569 100644 (file)
@@ -44,6 +44,6 @@ public class MetadataIndexDefinition {
 
     NewIndex.NewIndexType mapping = index.createType(INDEX_TYPE_METADATA.getType());
 
-    mapping.keywordFieldBuilder(FIELD_VALUE).disableSearch().build();
+    mapping.keywordFieldBuilder(FIELD_VALUE).disableSearch().store().build();
   }
 }