]> source.dussan.org Git - sonarqube.git/commitdiff
Merge branch 'master' into SONAR-4898
authorStephane Gamard <stephane.gamard@searchbox.com>
Thu, 31 Jul 2014 11:52:16 +0000 (13:52 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Thu, 31 Jul 2014 11:52:16 +0000 (13:52 +0200)
Conflicts:
server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java

1  2 
pom.xml
server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
server/sonar-server/src/test/java/org/sonar/server/tester/ServerTester.java
server/sonar-web/pom.xml

diff --cc pom.xml
Simple merge
index 2885b4c1dd81fdb0d36b170865500cfb479e5532,3add374335d61b35bf113f702c0a504fd2fcbaaa..ca4e42f7a9d07e027e7f9aae73aa601ce454a201
@@@ -22,6 -22,6 +22,7 @@@ package org.sonar.server.rule.index
  import com.google.common.base.Preconditions;
  import org.elasticsearch.action.search.SearchRequestBuilder;
  import org.elasticsearch.action.search.SearchResponse;
++import org.elasticsearch.action.search.SearchScrollRequestBuilder;
  import org.elasticsearch.action.search.SearchType;
  import org.elasticsearch.common.settings.ImmutableSettings;
  import org.elasticsearch.common.settings.Settings;
@@@ -414,14 -418,27 +415,29 @@@ public class RuleIndex extends BaseInde
     */
    @Deprecated
    public List<Rule> getByIds(Collection<Integer> ids) {
 -    SearchResponse scrollResp = getClient().prepareSearch(this.getIndexName())
 +    SearchRequestBuilder request = getClient().prepareSearch(this.getIndexName())
        .setTypes(this.getIndexType())
 -      .setQuery(QueryBuilders.termsQuery(RuleNormalizer.RuleField.ID.field(), ids))
 -      .get();
+       .setSearchType(SearchType.SCAN)
+       .setScroll(TimeValue.timeValueSeconds(3L))
+       .setSize(100)
-     SearchResponse response = node.execute(request);
 +      .setQuery(QueryBuilders.termsQuery(RuleNormalizer.RuleField.ID.field(), ids));
++    SearchResponse scrollResp = node.execute(request);
  
      List<Rule> rules = newArrayList();
-     for (SearchHit hit : response.getHits()) {
-       rules.add(toDoc(hit.getSource()));
+     while (true) {
 -      scrollResp = getClient()
++      SearchScrollRequestBuilder scrollRequest = getClient()
+         .prepareSearchScroll(scrollResp.getScrollId())
 -        .setScroll(TimeValue.timeValueSeconds(3L))
 -        .get();
++        .setScroll(TimeValue.timeValueSeconds(3L));
++
++      scrollResp = node.execute(scrollRequest);
++
+       for (SearchHit hit : scrollResp.getHits()) {
+         rules.add(toDoc(hit.getSource()));
+       }
+       //Break condition: No hits are returned
+       if (scrollResp.getHits().getHits().length == 0) {
+         break;
+       }
      }
      return rules;
    }
index b1bef3250f12618a07fda12d4d7e075be4d05047,8c7b6812118e4c9bb8c212e892a6cadf21543ff2..480382fae23e698351dab473609016fa96284b92
@@@ -24,7 -24,7 +24,6 @@@ import com.google.common.collect.Lists
  import org.apache.commons.io.FileUtils;
  import org.apache.commons.lang.StringUtils;
  import org.junit.rules.ExternalResource;
--import org.sonar.api.CoreProperties;
  import org.sonar.api.database.DatabaseProperties;
  import org.sonar.server.platform.Platform;
  import org.sonar.server.search.IndexProperties;
Simple merge