diff --git a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java index 8fa61eca4b..46592bd63c 100644 --- a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java @@ -166,7 +166,7 @@ public class SolrServiceImpl implements SearchService, IndexingService { * Make sure the item is not in the index if it is not in * archive or withwrawn. */ - unIndexContent(context, handle); + unIndexContent(context, item); log.info("Removed Item: " + handle + " from Index"); } break; diff --git a/dspace-api/src/main/java/org/dspace/search/DSIndexer.java b/dspace-api/src/main/java/org/dspace/search/DSIndexer.java index 2341af5311..69b6ea988b 100644 --- a/dspace-api/src/main/java/org/dspace/search/DSIndexer.java +++ b/dspace-api/src/main/java/org/dspace/search/DSIndexer.java @@ -275,7 +275,7 @@ public class DSIndexer { try { - IndexingTask task = prepareIndexingTask(dso, force); + IndexingTask task = prepareIndexingTask(context, dso, force); if (task != null) { processIndexingTask(task); @@ -653,9 +653,9 @@ public class DSIndexer } - static IndexingTask prepareIndexingTask(DSpaceObject dso, boolean force) throws SQLException, IOException, DCInputsReaderException + static IndexingTask prepareIndexingTask(Context context, DSpaceObject dso, boolean force) throws SQLException, IOException, DCInputsReaderException { - String handle = dso.getHandle(); + String handle = HandleManager.findHandle(context, dso); Term term = new Term("handle", handle); IndexingTask action = null; switch (dso.getType()) @@ -668,7 +668,7 @@ public class DSIndexer if (requiresIndexing(term, ((Item)dso).getLastModified()) || force) { log.info("Writing Item: " + handle + " to Index"); - action = new IndexingTask(IndexingTask.Action.UPDATE, term, buildDocumentForItem((Item)dso)); + action = new IndexingTask(IndexingTask.Action.UPDATE, term, buildDocumentForItem(context, (Item)dso)); } } else @@ -1041,9 +1041,9 @@ public class DSIndexer * @throws SQLException * @throws IOException */ - private static Document buildDocumentForItem(Item item) throws SQLException, IOException, DCInputsReaderException + private static Document buildDocumentForItem(Context context, Item item) throws SQLException, IOException, DCInputsReaderException { - String handle = item.getHandle(); + String handle = HandleManager.findHandle(context, item); // get the location string (for searching by collection & community) String location = buildItemLocationString(item); diff --git a/dspace-api/src/main/java/org/dspace/versioning/VersioningConsumer.java b/dspace-api/src/main/java/org/dspace/versioning/VersioningConsumer.java index a4b4714117..d857abb4da 100644 --- a/dspace-api/src/main/java/org/dspace/versioning/VersioningConsumer.java +++ b/dspace-api/src/main/java/org/dspace/versioning/VersioningConsumer.java @@ -50,6 +50,7 @@ public class VersioningConsumer implements Consumer { if(previous != null){ Item previousItem = previous.getItem(); if(previousItem != null){ + previousItem.setArchived(false); itemsToProcess.add(previousItem); //Fire a new modify event for our previous item //Due to the need to reindex the item in the search & browse index we need to fire a new event @@ -66,7 +67,6 @@ public class VersioningConsumer implements Consumer { for(Item item : itemsToProcess){ ctx.turnOffAuthorisationSystem(); try { - item.setArchived(false); item.update(); } finally { ctx.restoreAuthSystemState(); diff --git a/dspace/solr/search/conf/schema.xml b/dspace/solr/search/conf/schema.xml index ab4b6df6b3..e1d4ac179b 100644 --- a/dspace/solr/search/conf/schema.xml +++ b/dspace/solr/search/conf/schema.xml @@ -508,7 +508,7 @@ - +