nit0906 commented on code in PR #1193:
URL: https://github.com/apache/jackrabbit-oak/pull/1193#discussion_r1388147142


##########
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:
   returning false here would suggest that no write to the index happened. 
   From the doc for close method in FulltextIndexWriter.
   `/**
        * Closes the underlying resources.
        *
        * @param timestamp timestamp to be used for recording at status in 
NodeBuilder
        * @return true if index was updated or any write happened.
        */`
   
   



-- 
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]

Reply via email to