diff --git a/src/main/java/eu/dnetlib/app/directindex/mapping/SolrRecordMapper.java b/src/main/java/eu/dnetlib/app/directindex/mapping/SolrRecordMapper.java index 87e4daf..bab5ca3 100644 --- a/src/main/java/eu/dnetlib/app/directindex/mapping/SolrRecordMapper.java +++ b/src/main/java/eu/dnetlib/app/directindex/mapping/SolrRecordMapper.java @@ -266,6 +266,7 @@ public class SolrRecordMapper { final Instance instance = new Instance(); + // TODO verificare il valore (dovrebbe essere classid="0004" classname="Conference object") instance.setInstancetype(re.getResourceType()); instance.setCollectedfrom(collectedFrom); instance.setHostedby(hostedBy); diff --git a/src/main/java/eu/dnetlib/app/directindex/solr/XMLSolrSerializer.java b/src/main/java/eu/dnetlib/app/directindex/solr/XMLSolrSerializer.java index 0b2e64f..da9ff01 100644 --- a/src/main/java/eu/dnetlib/app/directindex/solr/XMLSolrSerializer.java +++ b/src/main/java/eu/dnetlib/app/directindex/solr/XMLSolrSerializer.java @@ -132,27 +132,26 @@ public class XMLSolrSerializer { } } - private static void addResultInstance(final Element childrenNode, final Instance p) { - // TODO Auto-generated method stub - /* + private static void addResultInstance(final Element childrenNode, final Instance i) { + final Element instanceNode = childrenNode.addElement("instance"); + //TODO manca il code o il name + addStructuredField(instanceNode, "instancetype", i.getInstancetype(), ModelConstants.DNET_PUBLICATION_RESOURCE, null); + addStructuredField(instanceNode, "accessright", i.getAccessright().getCode(), i.getAccessright().getLabel(), ModelConstants.DNET_ACCESS_MODES, null); + + final Element collectedFrom = instanceNode.addElement("collectedfrom"); + collectedFrom.addAttribute("id", i.getCollectedfrom().getDsId()); + collectedFrom.addAttribute("name", i.getCollectedfrom().getDsName()); + + final Element hostedBy = instanceNode.addElement("hostedby"); + hostedBy.addAttribute("id", i.getHostedby().getDsId()); + hostedBy.addAttribute("name", i.getHostedby().getDsName()); + + if (i.getUrl() != null) { + i.getUrl().forEach(url -> instanceNode.addElement("webresource").addElement("url").addText(url)); + } - - - - - - 2013-01-01 - - - - https://www.bib.irb.hr/683750 - - - - - */ } private static void addRelProject(final Element relsNode, final RelatedRecord p) {