3131/**
3232 *
3333 * @author EEA <br>
34- * Customized to accommodate requests from the University of Bergen Library.
34+ * Customized to accommodate requests from the University of Bergen Library.<br>
3535 * Hemed, 09-03-2015
3636 */
3737public class Harvester implements Runnable {
@@ -1050,8 +1050,7 @@ private Map<String, ArrayList<String>> getJsonMap(Resource rs, Set<Property> pro
10501050
10511051 /**
10521052 * Index or update all the resources in a Jena Model to ES
1053- * Note: Update works if the user has specified the flag "updateDocuments" to true in the river settings.
1054- * By default it is set to false.
1053+ * Note: Update works if the user has specified the flag "updateDocuments" to true in the river settings. It is set to false by default.
10551054 * By doing this, you can partial update the documents without full re-indexing.
10561055 * @param model the model to index
10571056 * @param bulkRequest a BulkRequestBuilder
@@ -1081,9 +1080,9 @@ private void addModelToES(Model model, BulkRequestBuilder bulkRequest) throws IO
10811080 while (rsiter .hasNext ()) {
10821081 Resource rs = rsiter .nextResource ();
10831082 Map <String , ArrayList <String >> jsonMap = getJsonMap (rs , properties , model );
1084-
1083+
1084+ //If updateDocuments is set to true, then prepare to update this document
10851085 if (updateDocuments ){
1086- //If updateDocuments is set to true, then prepare to update this document
10871086 prepareUpdateDocument (bulkRequest , mapToString (jsonMap ), rs .toString ());
10881087 }
10891088 else {
@@ -1097,7 +1096,7 @@ private void addModelToES(Model model, BulkRequestBuilder bulkRequest) throws IO
10971096 if (bulkLength % numberOfBulkActions == 0 ) {
10981097
10991098 BulkResponse bulkResponse = bulkRequest .execute ().actionGet ();
1100- // After executing, flush the BulkRequestBuilder.
1099+ // After executing, clear the BulkRequestBuilder.
11011100 bulkRequest = client .prepareBulk ();
11021101
11031102 if (bulkResponse .hasFailures ()) {
@@ -1115,7 +1114,7 @@ private void addModelToES(Model model, BulkRequestBuilder bulkRequest) throws IO
11151114 }
11161115
11171116 }
1118- //Show time taken to perfom the action
1117+ //Show time taken to perfom the action
11191118 String actionPerformed = updateDocuments == true ? "update: " : "index: " ;
11201119 logger .info ("\n ==========================================="
11211120 +"\n \t Total documents proccessed: " + bulkLength
@@ -1146,8 +1145,8 @@ private void processBulkResponseFailure(BulkResponse response) {
11461145
11471146
11481147
1149- /** Prepare update of a document in ElasticSearch. Given document ID, a document will be merged to the existing document
1150- * with this ID, if document does not exist, no update will be performed and the DocumentMissingException will be thrown.
1148+ /** Prepare update of a document in ElasticSearch. Given a document ID, document will be merged to the existing document
1149+ * with this ID, if original document does not exist, no update will be performed and the DocumentMissingException will be thrown.<b>
11511150 *
11521151 * This is useful if someone wants to update a partial document in ElasticSearch without full re-indexing.
11531152 * Hemed, 09-03-2015
0 commit comments