aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server/src
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-07-13 15:47:00 +0200
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>2017-08-09 15:09:54 +0200
commite9bc2b0915e620e0c8ea81e94ac6353e8ab67961 (patch)
tree702f1f2e015ca887ca1645602faef954c5a71011 /server/sonar-server/src
parentfba6ad10cd608de676bf1672db821651f2913c3d (diff)
downloadsonarqube-e9bc2b0915e620e0c8ea81e94ac6353e8ab67961.tar.gz
sonarqube-e9bc2b0915e620e0c8ea81e94ac6353e8ab67961.zip
SONAR-8798 term_vector only an analyzed keyword fields
Diffstat (limited to 'server/sonar-server/src')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexDefinition.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/NewIndex.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java3
3 files changed, 5 insertions, 6 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexDefinition.java
index 5a77c847914..593334fb608 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexDefinition.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexDefinition.java
@@ -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();
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 a4fb706fd99..42071805208 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
@@ -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);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
index c49f11dbe5f..3842a5b6275 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
@@ -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));
}