From cdb8dbecebdb6e69bd5ff9d1c5e67bf62203f837 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" <funk@sub.uni-goettingen.de> Date: Wed, 16 Jun 2021 17:08:21 +0200 Subject: [PATCH] Divide id and title, finally --- .../info/textgrid/middleware/SetDeliverer.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java index a3e1a0e7..b01b8e4a 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java @@ -40,6 +40,7 @@ public class SetDeliverer { private static final String DH_COLLECTION_FILTER_NAME = "collectionFilter"; private static final String DH_COLLECTION_FILTER_TERM_NAME = "collectionFilterTerm"; + private static final String DH_FIELD_DIVIDER = "&"; // private static Map<String, String> setSet = new Hashtable<String, String>(); @@ -125,7 +126,8 @@ public class SetDeliverer { else if (this.dariah) { Script mergeCollectionIDAndTitle = new Script( - "doc['administrativeMetadata.dcterms:identifier'].value + '&' + doc['descriptiveMetadata.dc:title'].value"); + "doc['administrativeMetadata.dcterms:identifier'].value + '" + DH_FIELD_DIVIDER + + "' + doc['descriptiveMetadata.dc:title'].value"); // Do filter all collections (via descriptiveMetadata.dc:format) AND // get out all the child objects and collections (NO descriptiveMetadata.dc:relation), @@ -235,12 +237,15 @@ public class SetDeliverer { Terms collectionTerms = filterCollection.getAggregations().get(DH_COLLECTION_FILTER_TERM_NAME); for (Bucket b : collectionTerms.getBuckets()) { - - System.out.println(" ## key as string --> " + b.getKeyAsString()); - + // Divide ID and title. + String combined = b.getKeyAsString(); + int indexOf = combined.indexOf(DH_COLLECTION_FILTER_NAME); + String id = combined.substring(0, indexOf); + String title = combined.substring(indexOf + 1); + // Set set. SetType newSet = new SetType(); - newSet.setSetSpec(b.getKeyAsString()); - newSet.setSetName("urgl! argl! aua!"); + newSet.setSetSpec(id); + newSet.setSetName(title); setList.getSet().add(newSet); } } -- GitLab