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

List Identifier Correction

parent f3e23b27
No related branches found
No related tags found
No related merge requests found
......@@ -126,20 +126,21 @@ public class IdentifierListDeliverer {
SearchRequestBuilder getListIdentifiersValuesBuilder = oaiEsClient
.getOaiESClient().prepareSearch(oaiEsClient.getEsIndex())
.setSearchType(SearchType.SCAN)
//.setSearchType(SearchType.SCAN)
.setScroll(new TimeValue(60000))
.setTypes(oaiEsClient.getEsType())
.addFields(identifierListFields)
.setQuery(query)
.setSize(searchResponseSize);
.setSize(10);
SearchResponse listListIdentiferValues = getListIdentifiersValuesBuilder.execute().actionGet();
SearchResponse listListIdentiferValues = getListIdentifiersValuesBuilder.execute().actionGet();
BigInteger bi2 = BigInteger.valueOf(listListIdentiferValues.getHits().getTotalHits()); //Number of Total Hits as BigInteger (required by oaipmh ResumptionToken)
BigInteger bi1 = BigInteger.valueOf(start); //start Value of the list. Important to increase the the cursor value of the resumption token
//if (listListIdentiferValues.getHits().getTotalHits() > 0) {
while (bi1.floatValue() < bi2.floatValue()) {
//while (bi1.floatValue() < bi2.floatValue()) {
listListIdentiferValues =hitHandling(listListIdentiferValues, listListIdentiferValues.getScrollId(), identifier, lit, set);
listListIdentiferValues = oaiEsClient.getOaiESClient()
......@@ -153,11 +154,11 @@ public class IdentifierListDeliverer {
lit.setResumptionToken(setResToken(bi2, bi1, listListIdentiferValues.getScrollId()));
if (listListIdentiferValues.getHits().getHits().length == 0) {
/*if (listListIdentiferValues.getHits().getHits().length == 0) {
break;
}
}*/
}
//}
return lit;
}
......@@ -166,16 +167,16 @@ public class IdentifierListDeliverer {
for (SearchHit hit : listFurtherValues.getHits().getHits()) {
if (this.textgrid && hit.getFields().get(formatField).getValue().toString().equals(formatToFilter)) {
String datestamp = hit.getFields().get("created").getValue().toString();
try {
String datestamp = hit.getFields().get(this.dateOfObjectCreation).getValue().toString();
try {
datestamp = OAIPMHUtillities.convertDateFormat(datestamp).toXMLFormat();
} catch (ParseException e1) {
log.debug(e1);
} catch (DatatypeConfigurationException e1) {
log.debug(e1);
}
}
System.out.println("IDENTIFIER FIELD: " + identifierField);
identifier = hit.getFields().get(identifierField).getValue().toString();
lit = setListIdentifierHeader(datestamp, identifier, lit, set);
}
......
......@@ -396,7 +396,15 @@ public class RecordListDeliverer {
//System.out.println("DateSize: " + dates.size());
if(dates.size() > 0){
header.setDatestamp(this.modifiedValue);
try {
header.setDatestamp(OAIPMHUtillities.convertDateFormat(this.modifiedValue).toXMLFormat());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DatatypeConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(textgrid)
identifierForHeader = this.identifiers.get(0);
if(identifierForHeader.startsWith("https://textgridrep.org/")){
......
......@@ -483,13 +483,12 @@ public class OaiPmhTest {
@Ignore
public void testListIdentifiers() throws ParseException {
this.identifierList.setFieldForRange(TGConstants.RANGE_FIELD);
this.identifierList
.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS);
this.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS);
this.identifierList.setFormatField(TGConstants.FORMAT);
this.identifierList.setFormatToFilter(TextGridMimetypes.EDITION);
this.identifierList.setDateOfObjectCreation(TGConstants.CREATED);
this.identifierList.setIdentifierField("textgridUri");
this.identifierList.setRepositoryObjectURIPrefix("textgridUri:");
this.identifierList.setRepositoryObjectURIPrefix("textgrid:");
JAXBElement<OAIPMHType> r = this.request.getRequest("ListIdentifiers",
"", "oai_dc", "", "", "", "");
......
......@@ -160,7 +160,7 @@
<property name="repositoryObjectURIPrefix" value="${repositoryObjectURIPrefix}" />
<property name="identifierListFields" value="${identifierListFields}"></property>
<property name="FieldForRange" value="${rangeField}" />
<property name="identifierField" value="${identifierField}" />
<property name="identifierField" value="${identifierField}" />
</bean>
<bean id="SetDeliverer" class="info.textgrid.middleware.SetDeliverer">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment