]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8798 arbitrary types like RuleType cannot be serialized by ES 5
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Wed, 19 Jul 2017 12:36:46 +0000 (14:36 +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/rule/index/RuleIndex.java

index e1669812974795da0ac60543af45324f195abc0e..7fd7069deda9568827b802010f27b90456122737 100644 (file)
@@ -263,9 +263,11 @@ public class RuleIndex {
       filters.put(FIELD_RULE_EXTENSION_TAGS, q);
     }
 
-    if (isNotEmpty(query.getTypes())) {
+    Collection<RuleType> types = query.getTypes();
+    if (isNotEmpty(types)) {
+      List<String> typeNames = types.stream().map(RuleType::toString).collect(MoreCollectors.toList());
       filters.put(FIELD_RULE_TYPE,
-        QueryBuilders.termsQuery(FIELD_RULE_TYPE, query.getTypes()));
+        QueryBuilders.termsQuery(FIELD_RULE_TYPE, typeNames));
     }
 
     if (query.getAvailableSinceLong() != null) {