]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8798 term_vector only an analyzed keyword fields
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 13 Jul 2017 13:47:00 +0000 (15:47 +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/component/index/ComponentIndexDefinition.java
server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java
server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java

index 5a77c847914bf00e87281e7ca116210017927470..593334fb608700ae369eb9d800d687191d6415a7 100644 (file)
@@ -62,7 +62,7 @@ public class ComponentIndexDefinition implements IndexDefinition {
     mapping.keywordFieldBuilder(FIELD_PROJECT_UUID).disableNorms().build();
     mapping.keywordFieldBuilder(FIELD_KEY).addSubFields(SORTABLE_ANALYZER).build();
     mapping.keywordFieldBuilder(FIELD_NAME)
-      .termVectorWithPositionOffsets()
+      .termVectorWithPositionOffsetsForAllSubfields()
       .addSubFields(NAME_ANALYZERS)
       .build();
 
index a4fb706fd9975a4aa858b924b412da2f0abf10a8..420718052085fd8b0fec9bbbe5bed9a77410c0a6 100644 (file)
@@ -241,7 +241,7 @@ public class NewIndex {
     /**
      * Position offset term vectors are required for the fast_vector_highlighter (fvh).
      */
-    public KeywordFieldBuilder termVectorWithPositionOffsets() {
+    public KeywordFieldBuilder termVectorWithPositionOffsetsForAllSubfields() {
       this.termVectorWithPositionOffsets = true;
       return this;
     }
@@ -283,9 +283,7 @@ public class NewIndex {
         multiFields.put(fieldName, ImmutableMap.of(
             "type", FIELD_TYPE_KEYWORD,
             "index", INDEX_SEARCHABLE,
-            "term_vector", termVectorWithPositionOffsets ? "with_positions_offsets" : "no",
-            "norms",
-            "false"
+            "norms", "false"
         ));
 
         hash.put("fields", multiFields);
index c49f11dbe5fecdacffca8ba5e3a9de6edef390b6..3842a5b62750d0af935103296a9d712fd43de33c 100644 (file)
@@ -325,7 +325,8 @@ public class RuleIndex {
       QProfileDto compareToQProfile = query.getCompareToQProfile();
       if (compareToQProfile != null) {
         filters.put("comparison",
-          QueryBuilders.hasChildQuery(INDEX_TYPE_ACTIVE_RULE.getType(),
+          QueryBuilders.hasChildQuery(
+            INDEX_TYPE_ACTIVE_RULE.getType(),
             boolQuery().must(QueryBuilders.termQuery(FIELD_ACTIVE_RULE_PROFILE_UUID, compareToQProfile.getRulesProfileUuid())),
             ScoreMode.None));
       }