1
0
Fork 0

[Provision]Branch to verify why the context tag for datasource and Projects are not visible in the index

This commit is contained in:
Miriam Baglioni 2024-07-01 16:53:29 +02:00
parent 14539f9c8b
commit 8157f94ff2
5 changed files with 74 additions and 2 deletions

View File

@ -59,4 +59,4 @@
<name>partitions</name>
<value>15000</value>
</property>
</configuration>
</configuration>

View File

@ -1605,7 +1605,8 @@ public class XmlRecordFactory implements Serializable {
if (contextMapper != null
&& !contextMapper.isEmpty()
&& MainEntityType.result.toString().equals(type)) {
// && MainEntityType.result.toString().equals(type)
) {
XMLTag document = XMLDoc.newDocument(true).addRoot("contextRoot");

View File

@ -14,6 +14,7 @@ import java.util.List;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import eu.dnetlib.dhp.schema.oaf.Datasource;
import org.apache.commons.io.IOUtils;
import org.apache.solr.client.solrj.util.ClientUtils;
import org.apache.solr.common.SolrInputDocument;
@ -85,6 +86,36 @@ public class IndexRecordTransformerTest {
testRecordTransformation(xmlRecord);
}
@Test
public void testDatasourceRecordTransformation() throws IOException, TransformerException, DocumentException {
final XmlRecordFactory xmlRecordFactory = new XmlRecordFactory(contextMapper, false,
PayloadConverterJob.schemaLocation);
final Datasource d = load("datasource.json", Datasource.class);
final JoinedEntity je = new JoinedEntity(d);
je
.setLinks(
Lists
.newArrayList()
);
final String xmlRecord = xmlRecordFactory.build(je);
assertNotNull(xmlRecord);
System.out.println(xmlRecord);
Document doc = new SAXReader().read(new StringReader(xmlRecord));
System.out.println("CONTEXT " + doc.valueOf( "//*[local-name()='datasource']//*[local-name()='context']"));
Assertions.assertEquals(0, doc.valueOf( "//*[local-name()='datasource']//*[local-name()='context']").length());
//testRecordTransformation(xmlRecord);
}
@Test
void testPeerReviewed() throws IOException, TransformerException {

View File

@ -41,6 +41,26 @@
"schemeid": "dnet:datasource_typologies_ui",
"schemename": "dnet:datasource_typologies_ui"
},
"context":[
{
"id":"netherlands",
"dataInfo":[
{
"invisible":false,
"inferred":false,
"deletedbyinference":false,
"trust":"0.9",
"inferenceprovenance":"",
"provenanceaction":{
"classid":"sysimport:crosswalk",
"classname":"sysimport:crosswalk",
"schemeid":"dnet:provenanceActions",
"schemename":"dnet:provenanceActions"
}
}
]
}
],
"pid": [
{
"value": "r3d100010218",

View File

@ -14,6 +14,26 @@
"value": "79a0e",
"datainfo": null
},
"context":[
{
"id":"netherlands",
"dataInfo":[
{
"invisible":false,
"inferred":false,
"deletedbyinference":false,
"trust":"0.9",
"inferenceprovenance":"",
"provenanceaction":{
"classid":"sysimport:crosswalk",
"classname":"sysimport:crosswalk",
"schemeid":"dnet:provenanceActions",
"schemename":"dnet:provenanceActions"
}
}
]
}
],
"acronym": {
"value": "79a0e_acronym",
"datainfo": null