Skip to content
Snippets Groups Projects
Commit 76d66f04 authored by mbrodhu's avatar mbrodhu
Browse files

further logging for ListRecords

parent 42c8b5ab
No related branches found
No related tags found
No related merge requests found
...@@ -384,8 +384,7 @@ public class OAIPMHImpl implements OAIPMHProducer { ...@@ -384,8 +384,7 @@ public class OAIPMHImpl implements OAIPMHProducer {
"The value of the identifier: " "The value of the identifier: "
+ request.getIdentifier() + request.getIdentifier()
+ " is unknown or illegal in this repository"); + " is unknown or illegal in this repository");
oai.getError().add( oai.getError().add(error.setError(TGConstants.OAI_NO_RECORD_MATCH));
error.setError(TGConstants.OAI_NO_RECORD_MATCH));
} }
} else { } else {
if (request.getFrom() != null) { if (request.getFrom() != null) {
...@@ -432,7 +431,7 @@ public class OAIPMHImpl implements OAIPMHProducer { ...@@ -432,7 +431,7 @@ public class OAIPMHImpl implements OAIPMHProducer {
+ request.getIdentifier()); + request.getIdentifier());
oai.getError().add(error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR)); oai.getError().add(error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR));
} else { } else {
listRecords = recordList.getRecordsWithSet(request.getFrom(), request.getUntil(), request.getSet(), request.getResumptionToken()); listRecords = recordList.getRecords(request.getFrom(), request.getUntil(), request.getSet(), request.getResumptionToken());
if (recordList.isFoundItems()) { if (recordList.isFoundItems()) {
// if(listRecords!=null){ // if(listRecords!=null){
oai.setListRecords(listRecords); oai.setListRecords(listRecords);
...@@ -442,8 +441,7 @@ public class OAIPMHImpl implements OAIPMHProducer { ...@@ -442,8 +441,7 @@ public class OAIPMHImpl implements OAIPMHProducer {
+ request.getFrom() + " and " + request.getFrom() + " and "
+ request.getUntil() + request.getUntil()
+ " results in an empty list"); + " results in an empty list");
oai.getError().add( oai.getError().add(error.setError(TGConstants.OAI_NO_RECORD_MATCH));
error.setError(TGConstants.OAI_NO_RECORD_MATCH));
} }
} }
} else { } else {
......
...@@ -346,7 +346,7 @@ public class RecordListDeliverer { ...@@ -346,7 +346,7 @@ public class RecordListDeliverer {
* @param set * @param set
* @return * @return
*/ */
public ListRecordsType getRecordsWithSet(String from, String to, String set, String resumptionToken) { public ListRecordsType getRecords(String from, String to, String set, String resumptionToken) {
System.out.println("RECOGNIZED SET WITH NAME: " + set); System.out.println("RECOGNIZED SET WITH NAME: " + set);
ListRecordsType recordList = new ListRecordsType(); ListRecordsType recordList = new ListRecordsType();
QueryBuilder query; QueryBuilder query;
...@@ -355,28 +355,13 @@ public class RecordListDeliverer { ...@@ -355,28 +355,13 @@ public class RecordListDeliverer {
if (set != null) { if (set != null) {
this.set = set; this.set = set;
System.out.println("SET IS HERE: " + set); System.out.println("SET IS HERE: " + set);
// NOTE For DARIAH, set contains the complete value of the
// dc:relation field that points to the DARIAH collection. We do
// need only the identifier of the set, so that we can query the
// ESDB so we take the complete content after THE LAST ":" setSpec
// delimeter.
String queryField = ""; String queryField = "";
String valueField = ""; String valueField = "";
if (this.dariah == true) { if (this.dariah == true) {
System.out.println("GOING INTO DARIAH"); System.out.println("GOING INTO DARIAH");
/*
* COLLECTIONREGISTRY_NAMESPACE is the name of the set Category
* but no field in ElasticSearch. It has to be queried in field
* "metadata.dc:relation".
*/
//System.out.println("DARIAH TRUE");
//set=set.replace("dariah:collection", "");
queryField = "descriptiveMetadata.dc:relation"; queryField = "descriptiveMetadata.dc:relation";
valueField = set; valueField = set;
// setParts[1] = setParts[1].concat(":" + setParts[2]);
// System.out.println(setParts[0] + " : " + setParts[1]);
} }
if (this.textgrid == true) { if (this.textgrid == true) {
...@@ -384,34 +369,19 @@ public class RecordListDeliverer { ...@@ -384,34 +369,19 @@ public class RecordListDeliverer {
String[] setParts = set.split(":"); String[] setParts = set.split(":");
if (setParts[0].equals("project")) { if (setParts[0].equals("project")) {
//System.out.println("Testitest4");
queryField = "project.id"; queryField = "project.id";
valueField = setParts[1]; valueField = setParts[1];
//System.out.println("Testitest4 " + valueField);
// setParts[0] = setParts[0].concat(".value");
} }
} }
QueryBuilder matchQuery = QueryBuilders.matchPhraseQuery(queryField, valueField); QueryBuilder matchQuery = QueryBuilders.matchPhraseQuery(queryField, valueField);
//QueryBuilder editionQuery = QueryBuilders.matchPhraseQuery(formatField, formatToFilter);
//QueryBuilder editionQuery = QueryBuilders.matchPhraseQuery("format", "text/tg.edition+tg.aggregation+xml");
//QueryBuilder boolQuery = QueryBuilders.boolQuery().must(matchQuery).must(editionQuery);
//System.out.println(matchQuery);
QueryBuilder boolQuery = QueryBuilders.boolQuery().must(rangeQuery).must(matchQuery); QueryBuilder boolQuery = QueryBuilders.boolQuery().must(rangeQuery).must(matchQuery);
//System.out.println("testitest5");
//System.out.println(rangeQuery);
//query = matchQuery;
query = boolQuery; query = boolQuery;
//System.out.println("TESTITEST");
//System.out.println(query);
//System.out.println("testitest6");
} else { } else {
query = rangeQuery; query = rangeQuery;
} }
//System.out.println("The query is: " + query);
try { try {
fetchFields(query, recordList, resumptionToken); fetchFields(query, recordList, resumptionToken);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
...@@ -427,7 +397,7 @@ public class RecordListDeliverer { ...@@ -427,7 +397,7 @@ public class RecordListDeliverer {
* @return * @return
*/ */
public HeaderType setHeader(String set) { public HeaderType setHeader(String set) {
System.out.println("HEADER TIME"); System.out.println("HEADER TIME WITH SET: " + set);
HeaderType header = new HeaderType(); HeaderType header = new HeaderType();
String identifierForHeader = ""; String identifierForHeader = "";
System.out.println("DATESIZE: " + dates.size()); System.out.println("DATESIZE: " + dates.size());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment