Remove startMore, endMore and endCutted from JSON responses
Change-Id: Ia40947f4949462f1fc9c1956066e159444f22552
diff --git a/Changes b/Changes
index 7ce2b5a..dd4acf8 100644
--- a/Changes
+++ b/Changes
@@ -1,10 +1,12 @@
-0.58.6 2019-06-04
+0.58.6 2019-06-19
- [bugfix] Updated cache loading (fixed #55) (diewald, margaretha)
- [bugfix] Introduce left match cutting so that
in matchinfo with expandToContext cutting won't
remove the actual match (diewald; reported by CoRoLa)
- [feature] Make retrieval of primarydata optional (fixes #58)
(diewald)
+ - [cleanup] Remove "startMore", "endMore", and "endCutted"
+ from JSON responses (diewald)
0.58.5 2019-03-18
- [bugfix] Fix bug where duplicate keys occured in
diff --git a/src/main/java/de/ids_mannheim/korap/response/Match.java b/src/main/java/de/ids_mannheim/korap/response/Match.java
index e1d3931..6f46fca 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -113,8 +113,7 @@
public int potentialStartPosChar = -1, potentialEndPosChar = -1;
@JsonIgnore
- public boolean startCutted = false;
- public boolean endCutted = false;
+ public boolean startCutted = false, endCutted = false;
private String version;
@@ -142,6 +141,8 @@
private HighlightCombinator snippetArray;
+
+ @JsonIgnore
public boolean startMore = true, endMore = true;
private Collection<byte[]> payload;
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
index 66fffc7..d3b2a0a 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -2,6 +2,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import java.util.*;
@@ -199,6 +200,10 @@
assertEquals("Ruru,Jens.Ol,Aglarech", km.toJsonNode().get("author").asText());
assertTrue(!km.toJsonNode().has("snippet"));
assertEquals("", km.getPrimaryData());
+ assertFalse(km.toJsonNode().has("startMore"));
+ assertFalse(km.toJsonNode().has("endMore"));
+ assertFalse(km.toJsonNode().has("endCutted"));
+ assertFalse(km.toJsonNode().has("snippet"));
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
index 69e339c..7861136 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -2,6 +2,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -227,8 +228,8 @@
res = mapper.readTree(km.toJsonString());
// assertEquals("tokens", res.at("/field").asText());
- assertTrue(res.at("/startMore").asBoolean());
- assertTrue(res.at("/endMore").asBoolean());
+ assertFalse(res.has("startMore"));
+ assertFalse(res.has("endMore"));
assertEquals("c1", res.at("/corpusID").asText());
assertEquals("d1", res.at("/docID").asText());
assertEquals("match-c1!d1-p7-9(4)8-8(2)7-8",
@@ -930,8 +931,8 @@
false, false);
JsonNode res = mapper.readTree(km.toJsonString());
// assertEquals("tokens", res.at("/field").asText());
- assertTrue(res.at("/startMore").asBoolean());
- assertTrue(res.at("/endMore").asBoolean());
+ assertFalse(res.has("startMore"));
+ assertFalse(res.has("endMore"));
assertEquals("c1", res.at("/corpusID").asText());
assertEquals("d4", res.at("/docID").asText());
assertEquals(
@@ -952,8 +953,8 @@
JsonNode res = mapper.readTree(km.toJsonString());
// assertEquals("tokens", res.at("/field").asText());
- assertTrue(res.at("/startMore").asBoolean());
- assertTrue(res.at("/endMore").asBoolean());
+ assertFalse(res.has("startMore"));
+ assertFalse(res.has("endMore"));
assertEquals("c1", res.at("/corpusSigle").asText());
assertEquals("c1/d1", res.at("/docSigle").asText());
assertEquals("c1/d1/t1", res.at("/textSigle").asText());
@@ -1071,8 +1072,8 @@
false, false);
JsonNode res = mapper.readTree(km.toJsonString());
// assertEquals("tokens", res.at("/field").asText());
- assertTrue(res.at("/startMore").asBoolean());
- assertTrue(res.at("/endMore").asBoolean());
+ assertFalse(res.has("startMore"));
+ assertFalse(res.has("endMore"));
assertEquals("ca1", res.at("/corpusID").asText());
assertEquals("da1", res.at("/docID").asText());
assertEquals("<span class=\"context-left\">" + "<span class=\"more\">"