diff --git a/dspace-api/src/main/java/org/dspace/app/deduplication/service/impl/SolrDedupServiceImpl.java b/dspace-api/src/main/java/org/dspace/app/deduplication/service/impl/SolrDedupServiceImpl.java index e12f1100be1..269bd23d467 100644 --- a/dspace-api/src/main/java/org/dspace/app/deduplication/service/impl/SolrDedupServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/app/deduplication/service/impl/SolrDedupServiceImpl.java @@ -679,11 +679,11 @@ public void optimize() { return; } long start = System.currentTimeMillis(); - System.out.println("SOLR Search Optimize -- Process Started:" + start); + System.out.println("SOLR Dedup Optimize -- Process Started:" + start); getSolr().optimize(); long finish = System.currentTimeMillis(); - System.out.println("SOLR Search Optimize -- Process Finished:" + finish); - System.out.println("SOLR Search Optimize -- Total time taken:" + (finish - start) + " (ms)."); + System.out.println("SOLR Dedup Optimize -- Process Finished:" + finish); + System.out.println("SOLR Dedup Optimize -- Total time taken:" + (finish - start) + " (ms)."); } catch (SolrServerException sse) { System.err.println(sse.getMessage()); } catch (IOException ioe) { diff --git a/dspace-api/src/main/java/org/dspace/app/solrdatabaseresync/SolrDatabaseResyncCli.java b/dspace-api/src/main/java/org/dspace/app/solrdatabaseresync/SolrDatabaseResyncCli.java index f901c9ca569..44fc07694cd 100644 --- a/dspace-api/src/main/java/org/dspace/app/solrdatabaseresync/SolrDatabaseResyncCli.java +++ b/dspace-api/src/main/java/org/dspace/app/solrdatabaseresync/SolrDatabaseResyncCli.java @@ -85,7 +85,7 @@ public void internalRun() throws Exception { timeUntilReindex = getTimeUntilReindex(); maxTime = getMaxTime(); - Context context = new Context(); + Context context = new Context(Context.Mode.READ_ONLY); try { context.turnOffAuthorisationSystem(); @@ -128,6 +128,7 @@ private void performStatusUpdate(Context context) throws SearchServiceException, if (indexableObject.isPresent()) { logDebugAndOut("Item exists in DB, updating solr document"); updateItem(context, indexableObject.get()); + context.uncacheEntity(indexableObject.get().getIndexedObject()); } else { logDebugAndOut("Item doesn't exist in DB, removing solr document"); removeItem(context, uniqueId); diff --git a/dspace-api/src/test/java/org/dspace/discovery/DiscoveryIT.java b/dspace-api/src/test/java/org/dspace/discovery/DiscoveryIT.java index 55be531418a..ba2c4768094 100644 --- a/dspace-api/src/test/java/org/dspace/discovery/DiscoveryIT.java +++ b/dspace-api/src/test/java/org/dspace/discovery/DiscoveryIT.java @@ -469,6 +469,7 @@ public void verifySolrRecordsOfDeletedObjectsPaginationTest() throws Exception { assertSearchQuery(IndexableItem.TYPE, 6, 6, 0, -1); // delete col3 and all items that it contained collectionService.delete(context, col3); + context.commit(); context.restoreAuthSystemState(); // check Collection type with start=0 and limit=default, we expect: indexableObjects=2, totalFound=2 @@ -562,6 +563,7 @@ public void disabledSolrToRemoveStaleObjectsTest() throws Exception { assertSearchQuery(IndexableItem.TYPE, 6, 6, 0, -1); // delete col3 and all items that it contained collectionService.delete(context, col3); + context.commit(); context.restoreAuthSystemState(); // check Collection type with start=0 and limit=default, @@ -653,6 +655,7 @@ public void disabledRerunOfSolrQueryDueToStaleObjectsTest() throws Exception { assertSearchQuery(IndexableItem.TYPE, 6, 6, 0, -1); // delete col3 and all items that it contained collectionService.delete(context, col3); + context.commit(); context.restoreAuthSystemState(); // check Collection type with start=0 and limit=default, diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/enhancer/RelatedItemEnhancerUpdatePoller.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/enhancer/RelatedItemEnhancerUpdatePoller.java index 391a5fc7963..1d341b61cce 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/enhancer/RelatedItemEnhancerUpdatePoller.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/enhancer/RelatedItemEnhancerUpdatePoller.java @@ -47,6 +47,7 @@ public void pollItemToUpdateAndProcess() { } log.debug("item enhancer poller committing"); context.commit(); + context.clear(); } context.restoreAuthSystemState(); context.complete();