use of org.elasticsearch.action.bulk.BulkRequestBuilder in project stash-codesearch-plugin by palantir.
the class SearchUpdateJobImpl method doUpdate.
@Override
public void doUpdate(Client client, GitScm gitScm, GlobalSettings globalSettings) {
if (!globalSettings.getIndexingEnabled()) {
return;
}
GitCommandBuilderFactory builderFactory = gitScm.getCommandBuilderFactory();
// List of bulk requests to execute sequentially at the end of the method
RequestBuffer requestBuffer = new RequestBuffer(client);
// Unique identifier for ref
String refDesc = toString();
// Hash of latest indexed commit
String prevHash = getLatestIndexedHash(client);
// Hash of latest commit on ref
String newHash = getLatestHash(builderFactory);
if (newHash == null) {
log.error("Aborting since hash is invalid");
return;
}
// Diff for files & process changes
Set<SimpleEntry<String, String>> filesToAdd = new LinkedHashSet<SimpleEntry<String, String>>();
try {
// Get diff --raw -z tokens
String[] diffToks = builderFactory.builder(repository).command("diff").argument("--raw").argument("--abbrev=40").argument("-z").argument(prevHash).argument(newHash).build(new StringOutputHandler(plf)).call().split("