]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 - Fixed list of fields in ES for WS
authorStephane Gamard <stephane.gamard@searchbox.com>
Mon, 19 May 2014 13:29:24 +0000 (15:29 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Mon, 19 May 2014 13:40:07 +0000 (15:40 +0200)
sonar-server/src/main/java/org/sonar/server/rule2/index/RuleIndex.java
sonar-server/src/test/java/org/sonar/server/rule2/index/RuleIndexMediumTest.java

index bb7dec369f571e4ac70cff3f948c7c0f0c03c040..05a28ea0748f59a4c3836a0674b601a28541b3b1 100644 (file)
@@ -246,9 +246,7 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
       fields = RuleNormalizer.RuleField.ALL_KEYS;
     }
 
-    //TODO limit source for available fields.
-    //esSearch.addFields(fields.toArray(new String[fields.size()]));
-    //esSearch.setSource(StringUtils.join(fields, ','));
+    esSearch.setFetchSource(fields.toArray(new String[fields.size()]),null);
 
     return esSearch;
   }
@@ -333,8 +331,11 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
 
     esSearch.setQuery(QueryBuilders.filteredQuery(qb, fb));
 
+    System.out.println("esSearch = " + esSearch);
+
     SearchResponse esResult = esSearch.get();
 
+    System.out.println("esResult = " + esResult);
     return new RuleResult(esResult);
   }
 
index 8f2756062474a73772804c37c90b55d5215e5f25..21876400ca3598647ae0ab8fd11e9ee17d76193d 100644 (file)
@@ -25,7 +25,6 @@ import com.google.common.collect.Sets;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.ClassRule;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.sonar.api.rule.RuleKey;
 import org.sonar.api.rule.RuleStatus;
@@ -137,7 +136,6 @@ public class RuleIndexMediumTest {
   }
 
   @Test
-  @Ignore
   public void select_doc_fields_to_return() {
     dao.insert(newRuleDto(RuleKey.of("javascript", "S001")), dbSession);
     dbSession.commit();