Fixed matchinfo in lightservice
Change-Id: I0cba0cad0d39c762ce0bf1ec47ea93617b70aa31
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
index 06b6106..0db2b48 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
@@ -1007,6 +1007,7 @@
user = controller.getUser(tokenContext.getUsername());
}
catch (KustvaktException e) {
+
jlog.error("Exception encountered: {}", e.string());
throw KustvaktResponseHandler.throwit(e);
}
@@ -1030,7 +1031,7 @@
if (spl != null) {
f_list.add(sep[0]);
l_list.add(sep[1]);
- }
+ };
results = searchKrill.getMatch(matchid, new ArrayList<>(
f_list), new ArrayList<>(l_list), spans, false,
true);
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
index e28b85b..1003e0d 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
@@ -313,6 +313,8 @@
&& !foundries.contains("*"))
f_list = new ArrayList<>(foundries);
+ spans = spans != null ? spans : false;
+
boolean match_only = foundries == null || foundries.isEmpty();
String results;
if (match_only)
diff --git a/src/main/resources/changelog b/src/main/resources/changelog
index 58275c3..e7e868c 100644
--- a/src/main/resources/changelog
+++ b/src/main/resources/changelog
@@ -2,6 +2,7 @@
13/10/2016
- MOD: updated search to use new siglen (diewald)
+ - MOD: fixed matchinfo retrieval in light service (diewald)
05/05/2015
- ADD: rest test suite for user service (hanl)
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index cba69e9..2b8d2a1 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -1,7 +1,7 @@
# Root logger option
#log4j.threshold=ALL
-log4j.rootLogger=INFO, stdout, debugLog
+log4j.rootLogger=ERROR, stdout, debugLog
log4j.logger.log=ERROR, errorLog
# Direct log messages to stdout
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java b/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
index 5e0c730..40fb0ad 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/SearchKrillTest.java
@@ -31,7 +31,6 @@
@Test
public void testInit () {
KustvaktConfiguration config = helper().getContext().getConfiguration();
- System.out.println("'" + config.getIndexDir() + "'");
SearchKrill krill = new SearchKrill(config.getIndexDir());
assertNotNull(krill);
}
@@ -56,6 +55,15 @@
assertNotEquals(0, krill.getIndex().numberOf("documents"));
}
+ @Test
+ public void testMatchInfo () {
+ KustvaktConfiguration config = helper().getContext().getConfiguration();
+ SearchKrill krill = new SearchKrill(config.getIndexDir());
+ assertNotNull(krill);
+ String matchinfo = krill.getMatch("WPD/AAA.00002/p169-197");
+ JsonNode node = JsonUtils.readTree(matchinfo);
+ assertEquals("Invalid match identifier", node.at("/errors/0/1").asText());
+ }
@Test
public void testSearch () {
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/LightServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/LightServiceTest.java
index ceb9a35..8a94c44 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/LightServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/LightServiceTest.java
@@ -143,6 +143,40 @@
.toString());
}
+ @Test
+ public void testMatchInfoGet1 () {
+ // match-WPD_AAA.00001-p4-5
+ ClientResponse response = resource()
+ .path(getAPIVersion())
+ //.path("corpus/GOE/AGI.00200/p13576-13577/matchInfo")
+ .path("corpus/WPD/AAA.00001/p4-5/matchInfo")
+ .queryParam("foundry", "*")
+ .queryParam("spans", "false")
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertEquals("WPD/AAA/00001", node.at("/textSigle").asText());
+ };
+
+ @Test
+ public void testMatchInfoGet2 () {
+ // match-WPD_AAA.00001-p4-5
+ ClientResponse response = resource()
+ .path(getAPIVersion())
+ //.path("corpus/GOE/AGI.00200/p13576-13577/matchInfo")
+ .path("corpus/WPD/AAA.00001/p4-5/matchInfo")
+ .queryParam("foundry", "*")
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertEquals("WPD/AAA/00001", node.at("/textSigle").asText());
+ };
@Test
public void testCQParameter () {
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
index c3b0e84..c541e7a 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
@@ -427,7 +427,7 @@
assertEquals(response.getStatus(),
ClientResponse.Status.OK.getStatusCode());
String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
+ JsonNode node = JsonUtils.readTree(ent);
assertNotNull(node);
assertEquals("koral:docGroup", node.at("/collection/@type").asText());
assertEquals("operation:or", node.at("/collection/operation").asText());
@@ -451,7 +451,6 @@
@Test
public void testMatchInfoGet () {
-
}