use of org.sonar.server.es.BulkIndexer in project sonarqube by SonarSource.
the class UserIndexer method doIndex.
private void doIndex(@Nullable String login, Size bulkSize) {
final BulkIndexer bulk = new BulkIndexer(esClient, UserIndexDefinition.INDEX_TYPE_USER.getIndex());
bulk.setSize(bulkSize);
try (DbSession dbSession = dbClient.openSession(false)) {
try (UserResultSetIterator rowIt = UserResultSetIterator.create(dbClient, dbSession, login)) {
doIndex(bulk, rowIt);
}
}
}
use of org.sonar.server.es.BulkIndexer in project sonarqube by SonarSource.
the class ActiveRuleIndexer method createBulkIndexer.
private BulkIndexer createBulkIndexer(Size size) {
BulkIndexer bulk = new BulkIndexer(esClient, INDEX_TYPE_ACTIVE_RULE.getIndex());
bulk.setSize(size);
return bulk;
}
use of org.sonar.server.es.BulkIndexer in project sonarqube by SonarSource.
the class TestIndexer method doIndex.
private long doIndex(@Nullable String projectUuid, Size bulkSize) {
final BulkIndexer bulk = new BulkIndexer(esClient, INDEX_TYPE_TEST.getIndex());
bulk.setSize(bulkSize);
DbSession dbSession = dbClient.openSession(false);
try {
TestResultSetIterator rowIt = TestResultSetIterator.create(dbClient, dbSession, projectUuid);
long maxUpdatedAt = doIndex(bulk, rowIt);
rowIt.close();
return maxUpdatedAt;
} finally {
dbSession.close();
}
}
use of org.sonar.server.es.BulkIndexer in project sonarqube by SonarSource.
the class ViewIndexer method index.
/**
* Index a single document.
* <p/>
* The views lookup cache will be cleared
*/
public void index(ViewDoc viewDoc) {
final BulkIndexer bulk = new BulkIndexer(esClient, ViewIndexDefinition.INDEX_TYPE_VIEW.getIndex());
bulk.start();
doIndex(bulk, viewDoc, true);
bulk.stop();
}
use of org.sonar.server.es.BulkIndexer in project sonarqube by SonarSource.
the class ViewIndexer method index.
private void index(DbSession dbSession, Map<String, String> viewAndProjectViewUuidMap, boolean needClearCache, Size bulkSize) {
final BulkIndexer bulk = new BulkIndexer(esClient, ViewIndexDefinition.INDEX_TYPE_VIEW.getIndex());
bulk.setSize(bulkSize);
bulk.start();
for (Map.Entry<String, String> entry : viewAndProjectViewUuidMap.entrySet()) {
String viewUuid = entry.getKey();
List<String> projects = dbClient.componentDao().selectProjectsFromView(dbSession, viewUuid, entry.getValue());
doIndex(bulk, new ViewDoc().setUuid(viewUuid).setProjects(projects), needClearCache);
}
bulk.stop();
}
Aggregations