Added fix for statistic test with new corpora
diff --git a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
index 5c50194..355ce67 100644
--- a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
+++ b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
@@ -242,9 +242,11 @@
// Get numbers from index (currently slow)
try {
docs = kc.numberOf("documents");
- tokens = kc.numberOf("tokens");
- sentences = kc.numberOf("sentences");
- paragraphs = kc.numberOf("paragraphs");
+ if (docs > 0) {
+ tokens = kc.numberOf("tokens");
+ sentences = kc.numberOf("base/sentences");
+ paragraphs = kc.numberOf("base/paragraphs");
+ };
}
catch (IOException e) {
e.printStackTrace();
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
index 971817b..b3b2357 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
@@ -68,8 +68,8 @@
assert node.get("documents").asInt() == 7;
assert node.get("tokens").asInt() == 279402;
// EM: why zero?
- assert node.get("sentences").asInt() == 0;
- assert node.get("paragraphs").asInt() == 0;
+ assertEquals(node.get("sentences").asInt(), 11047);
+ assertEquals(node.get("paragraphs").asInt(), 489);
}