From 2eaecebc332358b4b43b26ebc6687fcbfffb9776 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Wed, 1 Jul 2026 18:15:54 +0300 Subject: [PATCH 1/2] DRYD-2117: added denormPriorityImageList --- .../DefaultESDocumentWriter.java | 51 +++++++++++++++++++ .../tenants/tenant-bindings-proto-unified.xml | 30 +++++++++++ 2 files changed, 81 insertions(+) diff --git a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java index c8c3f01382..149e39cf74 100644 --- a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java +++ b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java @@ -59,6 +59,7 @@ public ObjectNode getDenormValues(DocumentModel doc) { denormConceptFields(doc, denormValues); denormMaterialFields(doc, denormValues); denormObjectNameFields(doc, denormValues); + denormPriorityImageList(doc, session, tenantId, denormValues); // Compute the title of the record for the public browser, and store it so that it can // be used for sorting ES query results. @@ -209,6 +210,56 @@ private void denormExhibitionRecords(CoreSession session, String csid, String te denormValues.putArray("exhibition").addAll(exhibitions); } + /** + * Denormalize the csid, blob csid, title, and alt text of each media record referenced by + * the priorityImageList field of a collectionobject, so that the priority/sort + * order set by the user can be displayed and searched. + * + * @param doc the collectionobject document + * @param session the current session + * @param tenantId the tenant id + * @param denormValues the json node for denormalized fields + */ + private void denormPriorityImageList(DocumentModel doc, CoreSession session, String tenantId, ObjectNode denormValues) { + List priorityImageList = (List) doc.getProperty("collectionobjects_common", "priorityImageList"); + List priorityImages = new ArrayList<>(); + + if (priorityImageList != null) { + for (String priorityImage : priorityImageList) { + if (StringUtils.isNotEmpty(priorityImage)) { + String mediaCsid = null; + + try { + mediaCsid = RefNameUtils.parseAuthorityInfo(priorityImage).csid; + } catch (IllegalArgumentException e) { + // Not a parseable refName; nothing to denormalize for this entry. + } + + if (mediaCsid != null) { + DocumentModel mediaDoc = getRecordByCsid(session, tenantId, "Media", mediaCsid); + + if (mediaDoc != null && isMediaPublished(mediaDoc)) { + String blobCsid = (String) mediaDoc.getProperty("media_common", "blobCsid"); + String title = (String) mediaDoc.getProperty("media_common", "title"); + String altText = (String) mediaDoc.getProperty("media_common", "altText"); + + ObjectNode priorityImageNode = objectMapper.createObjectNode(); + + priorityImageNode.put("csid", mediaCsid); + priorityImageNode.put("blobCsid", blobCsid); + priorityImageNode.put("title", title); + priorityImageNode.put("altText", altText); + + priorityImages.add(priorityImageNode); + } + } + } + } + } + + denormValues.putArray("priorityImageList").addAll(priorityImages); + } + /** * Denormalize the material group list for a collectionobject in order to index the controlled or uncontrolled term * diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml index 42834cb08d..5e3011030c 100644 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml +++ b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml @@ -1201,6 +1201,7 @@ "collectionobjects_common:objectStatusList", "collectionobjects_common:otherNumberList", "collectionobjects_common:ownersContributionNote", + "collectionobjects_common:priorityImageList", "collectionobjects_common:publishedRelatedLinkGroupList", "collectionobjects_common:publishToList", "collectionobjects_common:responsibleDepartments", @@ -1417,6 +1418,35 @@ "type": "keyword", "copy_to": "all_field" }, + "collectionobjects_common:priorityImageList": { + "type": "keyword", + "copy_to": "all_field", + "fields": { + "displayName": { + "type": "keyword", + "normalizer": "refname_displayname_normalizer" + } + } + }, + "collectionspace_denorm:priorityImageList": { + "type": "object", + "properties": { + "csid": { + "type": "keyword" + }, + "blobCsid": { + "type": "keyword" + }, + "title": { + "type": "text", + "copy_to": "all_field" + }, + "altText": { + "type": "text", + "copy_to": "all_field" + } + } + }, "collectionobjects_common:contentConcepts": { "type": "keyword", "copy_to": "all_field", From a67bde8b0b76317644388ca5353d8e7a046c7042 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Wed, 1 Jul 2026 18:29:41 +0300 Subject: [PATCH 2/2] DRYD-2117: updated changelog; --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c9e4f676d..6b13ba1ad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 9.0.0 * Add home location to collectionobject schema and advanced search +* Denormalize priority image list ## 8.3.0