[Provision]Branch to verify why the context tag for datasource and Projects are not visible in the index
This commit is contained in:
parent
14539f9c8b
commit
8157f94ff2
|
@ -59,4 +59,4 @@
|
||||||
<name>partitions</name>
|
<name>partitions</name>
|
||||||
<value>15000</value>
|
<value>15000</value>
|
||||||
</property>
|
</property>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -1605,7 +1605,8 @@ public class XmlRecordFactory implements Serializable {
|
||||||
|
|
||||||
if (contextMapper != null
|
if (contextMapper != null
|
||||||
&& !contextMapper.isEmpty()
|
&& !contextMapper.isEmpty()
|
||||||
&& MainEntityType.result.toString().equals(type)) {
|
// && MainEntityType.result.toString().equals(type)
|
||||||
|
) {
|
||||||
|
|
||||||
XMLTag document = XMLDoc.newDocument(true).addRoot("contextRoot");
|
XMLTag document = XMLDoc.newDocument(true).addRoot("contextRoot");
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.List;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
|
||||||
|
import eu.dnetlib.dhp.schema.oaf.Datasource;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.solr.client.solrj.util.ClientUtils;
|
import org.apache.solr.client.solrj.util.ClientUtils;
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
|
@ -85,6 +86,36 @@ public class IndexRecordTransformerTest {
|
||||||
testRecordTransformation(xmlRecord);
|
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
|
@Test
|
||||||
void testPeerReviewed() throws IOException, TransformerException {
|
void testPeerReviewed() throws IOException, TransformerException {
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,26 @@
|
||||||
"schemeid": "dnet:datasource_typologies_ui",
|
"schemeid": "dnet:datasource_typologies_ui",
|
||||||
"schemename": "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": [
|
"pid": [
|
||||||
{
|
{
|
||||||
"value": "r3d100010218",
|
"value": "r3d100010218",
|
||||||
|
|
|
@ -14,6 +14,26 @@
|
||||||
"value": "79a0e",
|
"value": "79a0e",
|
||||||
"datainfo": null
|
"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": {
|
"acronym": {
|
||||||
"value": "79a0e_acronym",
|
"value": "79a0e_acronym",
|
||||||
"datainfo": null
|
"datainfo": null
|
||||||
|
|
Loading…
Reference in New Issue