From 47ebcde2d7f9392b33bd1c2debdc4eb2a96fc26d Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 6 May 2024 16:07:06 +0200 Subject: [PATCH 1/2] Updated indexing of the Item for the OAI-PMH: show the Item if it is hidden from the search. --- dspace-api/src/main/java/org/dspace/content/Item.java | 3 +-- dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dspace-api/src/main/java/org/dspace/content/Item.java b/dspace-api/src/main/java/org/dspace/content/Item.java index d36ed81e414..034a2b6d213 100644 --- a/dspace-api/src/main/java/org/dspace/content/Item.java +++ b/dspace-api/src/main/java/org/dspace/content/Item.java @@ -174,8 +174,7 @@ public boolean isDiscoverable() { public boolean isHidden() { String valueOfHidden = getItemService().getMetadataFirstValue(this, "local", "hidden", null, Item.ANY); - if (Objects.nonNull(valueOfHidden) && valueOfHidden.equalsIgnoreCase("hidden")) { - + if (Objects.nonNull(valueOfHidden) && valueOfHidden.equalsIgnoreCase("hidden")) { return true; } return false; diff --git a/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java b/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java index 4f842b8e944..1d0d2e217f1 100644 --- a/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java +++ b/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java @@ -425,8 +425,14 @@ private SolrInputDocument index(Item item) * because this will override the item.public flag. */ + boolean discoverable = item.isDiscoverable(); + // The Item is not deleted when it has local metadata `local.hidden = hidden`. + // Without this, the item is not discoverable harvestable; however, it should be harvested via OAI-PMH. + if (!discoverable && item.isHidden()) { + discoverable = true; + } doc.addField("item.deleted", - (item.isWithdrawn() || !item.isDiscoverable() || (isEmbargoed ? isPublic : false))); + (item.isWithdrawn() || (!discoverable) || (isEmbargoed ? isPublic : false))); /* * An item that is embargoed will potentially not be harvested by incremental From 44b3b14a0c04cfe58eb64a79a90db9653ecd1004 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 6 May 2024 16:08:17 +0200 Subject: [PATCH 2/2] Updated doc --- dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java b/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java index 1d0d2e217f1..4930dd5956c 100644 --- a/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java +++ b/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java @@ -427,7 +427,7 @@ private SolrInputDocument index(Item item) boolean discoverable = item.isDiscoverable(); // The Item is not deleted when it has local metadata `local.hidden = hidden`. - // Without this, the item is not discoverable harvestable; however, it should be harvested via OAI-PMH. + // Without this, the item is not discoverable and harvestable; however, it should be harvestable via OAI-PMH. if (!discoverable && item.isHidden()) { discoverable = true; }