From 7f24c1dc84b525044e84795dc767f5c357006793 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" <funk@sub.uni-goettingen.de> Date: Thu, 17 Jun 2021 16:15:54 +0200 Subject: [PATCH] mc --- .../middleware/IdentifierListDelivererDC.java | 28 ++++++++++++++++--- .../webapp/WEB-INF/oaipmh.textgrid.properties | 5 ---- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererDC.java b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererDC.java index 4a7d1c24..63663558 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererDC.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererDC.java @@ -36,6 +36,9 @@ import info.textgrid.middleware.common.TextGridMimetypes; public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract { + private static final int lifeTimeResToken = 100; + private static final String DH_ES_DIVIDER = "."; + private static org.apache.commons.logging.Log log = LogFactory.getLog(IdentifierListDelivererDC.class); public static Map<String, Integer> cursorCollector = new Hashtable<String, Integer>(); @@ -49,7 +52,6 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract { private String dateOfObjectCreation; // Field for the object creation in the repository private String repositoryObjectURIPrefix; // private String identifierField; - private static final int lifeTimeResToken = 100; private int searchResponseSize; private long resultSize; @@ -122,11 +124,9 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract { // TODO: necessary? FetchSourceContext fetchSourceContext = new FetchSourceContext(true, includes, excludes); - SearchRequest searchRequest = new SearchRequest(OAI_ESClient.getEsIndex()).searchType(SearchType.QUERY_THEN_FETCH); - SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); searchSourceBuilder.query(query); searchSourceBuilder.size(this.searchResponseSize); @@ -188,13 +188,33 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract { System.out.println(" ## dateOfObjectCreation --> " + this.dateOfObjectCreation); + // Get date field. + if (this.dateOfObjectCreation.contains(DH_ES_DIVIDER)) { + // Divide date object. + String dateOfObjectCreationDivider[] = this.dateOfObjectCreation.split(DH_ES_DIVIDER); + String prefix = dateOfObjectCreationDivider[0]; + String suffix = dateOfObjectCreationDivider[1]; + + if (hit.getSourceAsMap().containsKey(prefix)) { + + System.out.println(" ## argl --> " + hit.getSourceAsMap().get(prefix)); + + // this.datestamp = + } + } else { + this.datestamp = hit.getSourceAsMap().get(this.dateOfObjectCreation).toString(); + } + + // Get identifier field. + + System.out.println(" ## entries --> " + hit.getSourceAsMap().entrySet()); System.out.println(" ## " + this.dateOfObjectCreation + "(" + hit.getId() + ") --> " + (hit.getSourceAsMap().get(this.dateOfObjectCreation) == null ? "NULL" : hit.getSourceAsMap().get(this.dateOfObjectCreation))); System.out.println(" ## containsKey --> " - + hit.getSourceAsMap().containsKey(this.dateOfObjectCreation)); + + hit.getSourceAsMap().keySet().contains(this.dateOfObjectCreation)); System.out .println(" ## get --> " + hit.getSourceAsMap().get(this.dateOfObjectCreation)); System.out.println(" ## innerHits --> " + hit.getInnerHits()); diff --git a/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.textgrid.properties b/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.textgrid.properties index 2c11a65a..ca8eaeaa 100644 --- a/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.textgrid.properties +++ b/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.textgrid.properties @@ -9,12 +9,7 @@ RS_ENDPOINT = https://textgridlab.org/1.0/tgoaipmh ############################ elasticSearch.url = 127.0.0.1 -<<<<<<< HEAD -elasticSearch.port = 9302 -elasticSearch.clusterName = tg-esx2-instance -======= elasticSearch.ports = 9202 9203 ->>>>>>> feature/elastic6 elasticSearch.index = textgrid-public elasticSearch.type = metadata elasticSearch.itemLimit = 100 -- GitLab