use of org.sonar.server.es.BulkIndexer in project sonarqube by SonarSource.
the class ComponentIndexer method doIndexByProjectUuid.
/**
* @param projectUuid the uuid of the project to analyze, or <code>null</code> if all content should be indexed.<br/>
* <b>Warning:</b> only use <code>null</code> during startup.
*/
private void doIndexByProjectUuid(@Nullable String projectUuid, Size bulkSize) {
BulkIndexer bulk = new BulkIndexer(esClient, INDEX_TYPE_COMPONENT.getIndex());
bulk.setSize(bulkSize);
bulk.start();
try (DbSession dbSession = dbClient.openSession(false)) {
dbClient.componentDao().selectForIndexing(dbSession, projectUuid, context -> {
ComponentDto dto = (ComponentDto) context.getResultObject();
bulk.add(newIndexRequest(toDocument(dto)));
});
}
bulk.stop();
}
use of org.sonar.server.es.BulkIndexer in project sonarqube by SonarSource.
the class ComponentIndexer method index.
void index(ComponentDto... docs) {
BulkIndexer bulk = new BulkIndexer(esClient, INDEX_TYPE_COMPONENT.getIndex());
bulk.setSize(Size.REGULAR);
bulk.start();
Arrays.stream(docs).map(ComponentIndexer::toDocument).map(ComponentIndexer::newIndexRequest).forEach(bulk::add);
bulk.stop();
}
use of org.sonar.server.es.BulkIndexer in project sonarqube by SonarSource.
the class PermissionIndexer method index.
private void index(Collection<PermissionIndexerDao.Dto> authorizations, AuthorizationScope scope, Size bulkSize) {
IndexType indexType = scope.getIndexType();
BulkIndexer bulkIndexer = new BulkIndexer(esClient, indexType.getIndex());
bulkIndexer.setSize(bulkSize);
bulkIndexer.start();
authorizations.stream().filter(scope.getProjectPredicate()).map(dto -> newIndexRequest(dto, indexType)).forEach(bulkIndexer::add);
bulkIndexer.stop();
}
Aggregations