Make defaultSearchContextLength and maxCharContextSize customizable.
Change-Id: I24a35e0ffa0b7904e3e8df38d87015bcb831d43e
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMaxContext.java b/src/test/java/de/ids_mannheim/korap/index/TestMaxContext.java
index 239d9eb..6072688 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMaxContext.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMaxContext.java
@@ -42,7 +42,7 @@
}
@Test
- public void testTokenContextSize () throws IOException {
+ public void testSmallerTokenContextSize () throws IOException {
assertEquals(25, KrillProperties.maxTokenContextSize);
@@ -61,7 +61,7 @@
assertEquals(5, km.getContext().left.getLength());
assertEquals(5, km.getContext().right.getLength());
};
-
+
@Test
public void searchWithLargerContextTokenSize ()
throws JsonMappingException, JsonProcessingException {
@@ -123,4 +123,19 @@
String rightContext = km.getSnippetBrackets().split("]]")[1];
assertEquals(KrillProperties.maxCharContextSize,rightContext.length() -4);
}
+
+ // for Kokokom
+ @Test
+ public void testIncreaseDefaultSearchContextSize () throws IOException {
+ KrillProperties.defaultSearchContextLength = 1000000000;
+
+ String jsonQuery = getJsonString(TestMaxContext.class
+ .getResource("/queries/flags/caseInsensitive.jsonld")
+ .getFile());
+ Krill ks = new Krill(jsonQuery);
+ Result kr = ks.apply(ki);
+ Match km = kr.getMatch(0);
+ assertEquals(6089, km.getSnippetBrackets().length());
+ KrillProperties.defaultSearchContextLength = 6;
+ };
}
diff --git a/src/test/resources/krill.properties b/src/test/resources/krill.properties
index fc26a13..5afab41 100644
--- a/src/test/resources/krill.properties
+++ b/src/test/resources/krill.properties
@@ -9,3 +9,4 @@
krill.match.expansion.includeContextSize = true
krill.match.max.token=50
krill.context.max.token=25
+krill.search.context.default=6
\ No newline at end of file
diff --git a/src/test/resources/queries/flags/caseInsensitive.jsonld b/src/test/resources/queries/flags/caseInsensitive.jsonld
index 7320f52..35f9f5e 100644
--- a/src/test/resources/queries/flags/caseInsensitive.jsonld
+++ b/src/test/resources/queries/flags/caseInsensitive.jsonld
@@ -18,6 +18,6 @@
"startPage":1,
"count":25,
"cutOff":true,
- "context":"paragraph"
+ "context":"text"
}
}