]> source.dussan.org Git - sonarqube.git/commitdiff
Clean source line index in BackendCleanup
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 22 Jan 2015 14:49:07 +0000 (15:49 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 22 Jan 2015 14:55:10 +0000 (15:55 +0100)
server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java

index 2335fbc5e60335ed20949fcc93d4f12573e07765..ade65f30ba8bc77ba936b635f7d663de37b54478 100644 (file)
@@ -26,8 +26,11 @@ import org.sonar.api.ServerComponent;
 import org.sonar.core.persistence.DatabaseVersion;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.persistence.MyBatis;
+import org.sonar.server.issue.index.IssueIndexDefinition;
 import org.sonar.server.search.IndexDefinition;
 import org.sonar.server.search.SearchClient;
+import org.sonar.server.source.index.SourceLineIndex;
+import org.sonar.server.source.index.SourceLineIndexDefinition;
 
 import java.sql.Connection;
 import java.sql.SQLException;
@@ -118,7 +121,8 @@ public class BackendCleanup implements ServerComponent {
       deleteManualRules(connection);
 
       // Clear inspection indexes
-      clearIndex(IndexDefinition.ISSUES);
+      clearIndex(IssueIndexDefinition.INDEX);
+      clearIndex(SourceLineIndexDefinition.INDEX);
 
     } finally {
       dbSession.close();
@@ -149,9 +153,9 @@ public class BackendCleanup implements ServerComponent {
   /**
    * Completely remove a index with all types
    */
-  public void clearIndex(IndexDefinition indexDefinition) {
+  public void clearIndex(String indexName) {
     searchClient.prepareDeleteByQuery(searchClient.prepareState().get()
-      .getState().getMetaData().concreteIndices(new String[] {indexDefinition.getIndexName()}))
+      .getState().getMetaData().concreteIndices(new String[] {indexName}))
       .setQuery(QueryBuilders.matchAllQuery())
       .get();
   }