Added additional statistic figures to virtual corpus info API response.
Change-Id: I60796d2ea73414c04d402675fcd0a1f64a6b82d2
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusDto.java b/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusDto.java
index d44ade7..ae530c2 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusDto.java
@@ -23,4 +23,8 @@
private String createdBy;
private int numberOfDoc;
+ private int numberOfParagraphs;
+ private int numberOfSentences;
+ private int numberOfTokens;
+
private String koralQuery;}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
index 7a13e89..f9872f7 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
@@ -34,8 +34,10 @@
dto.setKoralQuery(vc.getKoralQuery());
JsonNode node = JsonUtils.readTree(statistics);
- int numberOfDoc = node.at("/documents").asInt();
- dto.setNumberOfDoc(numberOfDoc);
+ dto.setNumberOfDoc(node.at("/documents").asInt());
+ dto.setNumberOfParagraphs(node.at("/paragraphs").asInt());
+ dto.setNumberOfSentences(node.at("/sentences").asInt());
+ dto.setNumberOfTokens(node.at("/tokens").asInt());
return dto;
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
index a696b57..e95f0e4 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
@@ -131,6 +131,10 @@
assertEquals("system-vc", node.at("/name").asText());
assertEquals(VirtualCorpusType.SYSTEM.displayName(),
node.at("/type").asText());
+ assertEquals(11, node.at("/numberOfDoc"));
+ assertEquals(772, node.at("/numberOfParagraphs"));
+ assertEquals(25074, node.at("/numberOfSentences"));
+ assertEquals(665842, node.at("/numberOfTokens"));
}
@Test