forked from D-Net/dnet-hadoop
[graph provision] added tests for new peerreviewed field
This commit is contained in:
parent
a6d635e695
commit
ff924215b8
|
@ -78,6 +78,22 @@ public class IndexRecordTransformerTest {
|
|||
testRecordTransformation(record);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPeerReviewed() throws IOException, TransformerException {
|
||||
|
||||
final XmlRecordFactory xmlRecordFactory = new XmlRecordFactory(contextMapper, false,
|
||||
XmlConverterJob.schemaLocation);
|
||||
|
||||
final Publication p = load("publication.json", Publication.class);
|
||||
|
||||
final JoinedEntity<Publication> je = new JoinedEntity<>(p);
|
||||
final String record = xmlRecordFactory.build(je);
|
||||
assertNotNull(record);
|
||||
SolrInputDocument solrDoc = testRecordTransformation(record);
|
||||
|
||||
assertEquals("true", solrDoc.get("peerreviewed").getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRiunet() throws IOException, TransformerException {
|
||||
|
||||
|
@ -184,7 +200,7 @@ public class IndexRecordTransformerTest {
|
|||
}
|
||||
}
|
||||
|
||||
private void testRecordTransformation(final String record) throws IOException, TransformerException {
|
||||
private SolrInputDocument testRecordTransformation(final String record) throws IOException, TransformerException {
|
||||
final String fields = IOUtils.toString(getClass().getResourceAsStream("fields.xml"));
|
||||
final String xslt = IOUtils.toString(getClass().getResourceAsStream("layoutToRecordTransformer.xsl"));
|
||||
|
||||
|
@ -200,6 +216,8 @@ public class IndexRecordTransformerTest {
|
|||
|
||||
Assertions.assertNotNull(xmlDoc);
|
||||
System.out.println(xmlDoc);
|
||||
|
||||
return solrDoc;
|
||||
}
|
||||
|
||||
private <T> T load(final String fileName, final Class<T> clazz) throws IOException {
|
||||
|
|
|
@ -132,7 +132,12 @@ public class XmlIndexingJobTest extends SolrTest {
|
|||
rsp = miniCluster.getSolrClient().query(new SolrQuery().add(CommonParams.Q, "publiclyfunded:true"));
|
||||
assertEquals(
|
||||
0, rsp.getResults().getNumFound(),
|
||||
"the number of indexed records having publiclyfunded = publiclyfunded");
|
||||
"the number of indexed records having publiclyfunded = true");
|
||||
|
||||
rsp = miniCluster.getSolrClient().query(new SolrQuery().add(CommonParams.Q, "peerreviewed:true"));
|
||||
assertEquals(
|
||||
0, rsp.getResults().getNumFound(),
|
||||
"the number of indexed records having peerreviewed = true");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -97,8 +97,6 @@ public class XmlRecordFactoryTest {
|
|||
assertEquals("bronze", doc.valueOf("//*[local-name() = 'result']/openaccesscolor/text()"));
|
||||
assertEquals("true", doc.valueOf("//*[local-name() = 'result']/isindiamondjournal/text()"));
|
||||
assertEquals("true", doc.valueOf("//*[local-name() = 'result']/publiclyfunded/text()"));
|
||||
|
||||
System.out.println(doc.asXML());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -74,6 +74,9 @@
|
|||
<FIELD indexable="true" multivalued="false" name="isindiamondjournal" result="false" stat="false" type="boolean" value="//*[local-name()='entity']/*[local-name()='result']/isindiamondjournal"/>
|
||||
<FIELD indexable="true" multivalued="false" name="publiclyfunded" result="false" stat="false" type="boolean" value="//*[local-name()='entity']/*[local-name()='result']/publiclyfunded"/>
|
||||
|
||||
<FIELD indexable="true" multivalued="false" name="peerreviewed" result="false" stat="false" type="boolean" value="some $refereed in //*[local-name()='entity']/*[local-name()='result']/children/instance/*[local-name()='refereed']/@classid satisfies ($refereed = '0001')"/>
|
||||
|
||||
|
||||
<FIELD indexable="true" name="eoscifguidelines" result="false" stat="false" tokenizable="false" xpath="distinct-values(//*[local-name() = 'result']/eoscifguidelines/@code)"/><!-- FOS and SDGs non tokenizable for faceted search-->
|
||||
<FIELD indexable="true" name="fos" result="false" stat="false" tokenizable="false" xpath="distinct-values(//*[local-name()='entity']/*[local-name()='result']/subject[@classid='FOS'])"/>
|
||||
<FIELD indexable="true" name="foslabel" result="false" stat="false" tokenizable="false" value="concat(./text(), '||', replace(./text(), '^\d+\s', ''))" xpath="//*[local-name()='entity']/*[local-name()='result']/subject[@classid='FOS']"/>
|
||||
|
|
|
@ -358,6 +358,7 @@
|
|||
<field name="openaccesscolor" type="string" multiValued="false" indexed="true" stored="false"/>
|
||||
<field name="isindiamondjournal" type="boolean" multiValued="false" indexed="true" stored="false"/>
|
||||
<field name="publiclyfunded" type="boolean" multiValued="false" indexed="true" stored="false"/>
|
||||
<field name="peerreviewed" type="boolean" multiValued="false" indexed="true" stored="false"/>
|
||||
|
||||
<!-- Copy field definitions follow: -->
|
||||
|
||||
|
|
|
@ -371,6 +371,7 @@
|
|||
<field name="openaccesscolor" type="string" multiValued="false" indexed="true" stored="false"/>
|
||||
<field name="isindiamondjournal" type="boolean" multiValued="false" indexed="true" stored="false"/>
|
||||
<field name="publiclyfunded" type="boolean" multiValued="false" indexed="true" stored="false"/>
|
||||
<field name="peerreviewed" type="boolean" multiValued="false" indexed="true" stored="false"/>
|
||||
|
||||
<copyField source="datasourceenglishname" dest="__all"/>
|
||||
<copyField source="datasourceoddescription" dest="__all"/>
|
||||
|
|
Loading…
Reference in New Issue