fabriziofortino commented on code in PR #1193:
URL: https://github.com/apache/jackrabbit-oak/pull/1193#discussion_r1389223165
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexWriter.java:
##########
@@ -134,21 +123,24 @@ class ElasticIndexWriter implements
FulltextIndexWriter<ElasticDocument> {
@Override
public void updateDocument(String path, ElasticDocument doc) throws
IOException {
- IndexRequest request = new IndexRequest(indexName)
- .id(ElasticIndexUtils.idFromPath(path))
- .source(doc.build(), XContentType.JSON);
- bulkProcessorHandler.add(request);
+ bulkProcessorHandler.update(ElasticIndexUtils.idFromPath(path), doc);
}
@Override
public void deleteDocuments(String path) throws IOException {
- DeleteRequest request = new
DeleteRequest(indexName).id(ElasticIndexUtils.idFromPath(path));
- bulkProcessorHandler.add(request);
+ bulkProcessorHandler.delete(ElasticIndexUtils.idFromPath(path));
}
@Override
public boolean close(long timestamp) throws IOException {
- boolean updateStatus = bulkProcessorHandler.close();
+ boolean updateStatus;
+ try {
+ updateStatus = bulkProcessorHandler.close();
+ } catch (InterruptedException e) {
+ LOG.warn("Interrupted while waiting for bulk processor to close",
e);
+ Thread.currentThread().interrupt(); // restore interrupt status
+ return false;
Review Comment:
Right. I have moved the InterruptedException handling in the
BulkProcessorHandler so we can return the correct status.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]