Fixed match marking by introducing match areas in snippets
Change-Id: I83e19519979593be99f5f3c5559a5299032c813c
diff --git a/Changes b/Changes
index caaa268..e6ecae1 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.55.6 2016-07-27
+0.55.6 2016-08-03
- [bugfix] distance with key "t" uses default foundry (diewald)
- [cleanup] Renamed fromJson() to fromKoral() (diewald)
- [cleanup] Removed deprecated methods in Krill:
@@ -14,7 +14,7 @@
- [feature] Added experimental KrillStats class (diewald)
- [bugfix] Escape quotes in JSON strings (diewald)
- [bugfix] Escape XML and Brackets in snippets correctly (diewald)
- - [feature] Added match highlight to match API,
+ - [feature] Differ between matching scope and match highlighting,
in case the match was extended to the sentence scope (diewald)
0.55.5 2016-05-02
diff --git a/src/main/java/de/ids_mannheim/korap/KrillIndex.java b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
index 48ce9d0..bc10a5d 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
@@ -918,8 +918,6 @@
if (match.getStartPos() == -1)
return match;
- // Todo: add match-highlight
-
// Create a filter based on the corpusID and the docID
BooleanQuery bool = new BooleanQuery();
if (match.getTextSigle() != null) {
@@ -1033,7 +1031,7 @@
if (DEBUG)
log.trace("The final regexObj is {}", regexObj.toString());
};
-
+
try {
// Iterate over all atomic indices and find the matching document
@@ -1094,16 +1092,19 @@
// Todo:
SearchContext context = match.getContext();
+ // Override the normal match marking
+ // to have an inner match
+ match.overrideMatchPosition(
+ match.getStartPos(),
+ match.getEndPos() - 1
+ );
+
+
// Search for minimal surrounding sentences
if (extendToSentence) {
String element = "base/s:s";
int[] spanContext = match.expandContextToSpan(element);
- // Add match highlight with class number -1
- // TODO: This is very specific behaviour here and should probably
- // be added elsewhere, too.
- match.addHighlight(match.getStartPos(), match.getEndPos() - 1, -1);
-
if (DEBUG)
log.trace("Extend to sentence element '{}'", element);
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 acba433..40c7300 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -71,6 +71,9 @@
public int startPos, endPos = -1;
@JsonIgnore
+ private int innerMatchStartPos, innerMatchEndPos = -1;
+
+ @JsonIgnore
public int potentialStartPosChar = -1, potentialEndPosChar = -1;
private String version;
@@ -163,7 +166,6 @@
for (int[] pos : id.getPos()) {
if (pos[0] < id.getStartPos() || pos[1] > id.getEndPos())
continue;
-
this.addHighlight(pos[0], pos[1], pos[2]);
};
};
@@ -785,7 +787,8 @@
// Start building highlighted snippets
private boolean _processHighlight () {
- if (processed)
+
+ if (processed)
return true;
// Relevant details are missing
@@ -807,6 +810,10 @@
log.trace("PTO will retrieve {} & {} (Match boundary)",
this.getStartPos(), this.getEndPos());
+ // Set inner match
+ if (this.innerMatchEndPos != 1)
+ this.addHighlight(this.innerMatchStartPos, this.innerMatchEndPos, -1);
+
// Add all highlights for character retrieval
if (this.highlight != null) {
for (Highlight hl : this.highlight) {
@@ -867,7 +874,14 @@
return -1;
}
else if (arg0[1] == arg1[1]) {
- return 0;
+
+ // Compare class number
+ if (arg0[2] > arg1[2])
+ return 1;
+ else if (arg0[2] < arg1[1])
+ return -1;
+ return 0;
+
}
return 1;
};
@@ -876,7 +890,7 @@
};
/*
- Comparator class for closing tags
+ * Comparator class for closing tags
*/
private class ClosingTagComparator implements Comparator<int[]> {
@Override
@@ -886,14 +900,15 @@
return 1;
}
else if (arg0[1] == arg1[1]) {
- // Check start positions
- if (arg0[0] < arg1[0]) {
- return 1;
- }
- else if (arg0[0] == arg1[0]) {
- return 0;
- };
- return -1;
+
+ // Check start positions
+ if (arg0[0] < arg1[0]) {
+ return 1;
+ }
+ else if (arg0[0] == arg1[0]) {
+ return 0;
+ };
+ return -1;
};
return -1;
};
@@ -1004,10 +1019,11 @@
rightContext.append("</span>");
// Iterate through all remaining elements
+ sb.append("<span class=\"match\">");
for (short i = start; i <= end; i++) {
sb.append(this.snippetArray.get(i).toHTML(this, level, levelCache));
};
-
+ sb.append("</span>");
sb.append(rightContext);
return (this.snippetHTML = sb.toString());
@@ -1023,14 +1039,43 @@
if (this.processed && this.snippetBrackets != null)
return this.snippetBrackets;
+ // Snippet stack sizes
+ short start = (short) 0;
+ short end = this.snippetArray.size();
+ end--;
+
StringBuilder sb = new StringBuilder();
if (this.startMore)
sb.append("... ");
- for (HighlightCombinatorElement hce : this.snippetArray.list())
- sb.append(hce.toBrackets(this));
+ // First element of sorted array
+ HighlightCombinatorElement elem = this.snippetArray.getFirst();
+ if (elem.type == 0) {
+ sb.append(elem.toBrackets(this));
+ start++;
+ };
+ sb.append("[");
+
+ // Last element of sorted array
+ elem = this.snippetArray.getLast();
+ StringBuilder rightContext = new StringBuilder();
+
+ // Last element is textual
+ if (elem != null && elem.type == 0) {
+ rightContext.append(elem.toBrackets(this));
+ // decrement end
+ end--;
+ };
+
+ for (short i = start; i <= end; i++) {
+ sb.append(this.snippetArray.get(i).toBrackets(this));
+ };
+
+ sb.append("]");
+ sb.append(rightContext);
+
if (this.endMore)
sb.append(" ...");
@@ -1088,6 +1133,20 @@
return stack;
};
+ /**
+ * Sometimes the match start and end positions are inside the
+ * matching region, e.g. when the match was expanded.
+ * This will override the original matching positions
+ * And matrk the real matching.
+ */
+ public void overrideMatchPosition (int start, int end) {
+ if (DEBUG)
+ log.trace("--- Override match position");
+
+ this.innerMatchStartPos = start;
+ this.innerMatchEndPos = end;
+ };
+
/**
* This will retrieve character offsets for all spans.
@@ -1145,8 +1204,9 @@
// Recalculate startOffsetChar
int startOffsetChar = startPosChar - intArray[0];
- // Add match span
- this.span.add(intArray);
+ // Add match span, in case no inner match is defined
+ if (this.innerMatchEndPos == -1)
+ this.span.add(intArray);
// highlights
// -- I'm not sure about this.
diff --git a/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java b/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
index 42f1c08..1190eb4 100644
--- a/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
+++ b/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
@@ -52,6 +52,8 @@
// Opening
if (this.type == 1) {
StringBuilder sb = new StringBuilder();
+
+ // This is the surrounding match mark
if (this.number == -1) {
sb.append("<mark>");
}
diff --git a/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java b/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
index 7b2bd7c..0b1eb95 100644
--- a/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
+++ b/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
@@ -48,15 +48,15 @@
assertEquals(61, kr.getMatch(0).getStartPos());
assertEquals(64, kr.getMatch(0).getEndPos());
assertEquals(
- "... Bruckner (Wien) und Mathis Lussy (Paris). [{1:Inspiriert} "
- + "{2:durch die}] additiven Modelle arabischer Rhythmik (er half ...",
+ "... Bruckner (Wien) und Mathis Lussy (Paris). [[{1:Inspiriert} "
+ + "{2:durch die}]] additiven Modelle arabischer Rhythmik (er half ...",
kr.getMatch(0).getSnippetBrackets());
assertEquals(31, kr.getMatch(1).getStartPos());
assertEquals(34, kr.getMatch(1).getEndPos());
assertEquals(
- "... des Sendens wird ein unhörbarer Unterton [{1:mitgesendet}, "
- + "{2:auf den}] das angesprochene Funkgerät reagiert. Die Abkürzung ...",
+ "... des Sendens wird ein unhörbarer Unterton [[{1:mitgesendet}, "
+ + "{2:auf den}]] das angesprochene Funkgerät reagiert. Die Abkürzung ...",
kr.getMatch(1).getSnippetBrackets());
}
diff --git a/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java b/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
index d363d7d..c8a7a5a 100644
--- a/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
+++ b/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
@@ -51,7 +51,7 @@
assertEquals(km.getStartPos(1), 1);
assertEquals(km.getEndPos(1), 2);
assertEquals(
- "<span class=\"context-left\">a</span><mark><mark class=\"class-1 level-0\">b</mark></mark><span class=\"context-right\">c</span>",
+ "<span class=\"context-left\">a</span><span class=\"match\"><mark><mark class=\"class-1 level-0\">b</mark></mark></span><span class=\"context-right\">c</span>",
km.getSnippetHTML());
kr = ki.search((SpanQuery) kq.seq(kq._(1, kq.seg("s:b")))
@@ -64,7 +64,7 @@
assertEquals(km.getStartPos(2), 2);
assertEquals(km.getEndPos(2), 3);
assertEquals(
- "<span class=\"context-left\">a</span><mark><mark class=\"class-1 level-0\">b</mark><mark class=\"class-2 level-0\">c</mark></mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\">a</span><span class=\"match\"><mark><mark class=\"class-1 level-0\">b</mark><mark class=\"class-2 level-0\">c</mark></mark></span><span class=\"context-right\"></span>",
km.getSnippetHTML());
@@ -79,7 +79,7 @@
assertEquals(km.getStartPos(2), 2);
assertEquals(km.getEndPos(2), 3);
assertEquals(
- "<span class=\"context-left\"></span><mark><mark class=\"class-1 level-0\">ab</mark><mark class=\"class-2 level-0\">c</mark></mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark><mark class=\"class-1 level-0\">ab</mark><mark class=\"class-2 level-0\">c</mark></mark></span><span class=\"context-right\"></span>",
km.getSnippetHTML());
@@ -97,7 +97,7 @@
assertEquals(km.getStartPos(3), 0);
assertEquals(km.getEndPos(3), 3);
assertEquals(
- "<span class=\"context-left\"></span><mark><mark class=\"class-3 level-0\"><mark class=\"class-1 level-1\">ab</mark><mark class=\"class-2 level-1\">c</mark></mark></mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark><mark class=\"class-3 level-0\"><mark class=\"class-1 level-1\">ab</mark><mark class=\"class-2 level-1\">c</mark></mark></mark></span><span class=\"context-right\"></span>",
km.getSnippetHTML());
};
@@ -124,18 +124,18 @@
Match km = kr.getMatch(0);
km.addHighlight(0, 1, (short) 7);
assertEquals(
- "<span class=\"context-left\"></span><mark><mark class=\"class-7 level-0\">ab</mark>c</mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark><mark class=\"class-7 level-0\">ab</mark>c</mark></span><span class=\"context-right\"></span>",
km.getSnippetHTML());
km.addHighlight(1, 2, (short) 6);
assertEquals(
- "<span class=\"context-left\"></span><mark><mark class=\"class-7 level-0\">a<mark class=\"class-6 level-1\">b</mark></mark><mark class=\"class-6 level-1\">c</mark></mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark><mark class=\"class-7 level-0\">a<mark class=\"class-6 level-1\">b</mark></mark><mark class=\"class-6 level-1\">c</mark></mark></span><span class=\"context-right\"></span>",
km.getSnippetHTML());
km.addHighlight(0, 1, (short) 5);
- assertEquals("[{7:{5:a{6:b}}}{6:c}]", km.getSnippetBrackets());
+ assertEquals("[[{7:{5:a{6:b}}}{6:c}]]", km.getSnippetBrackets());
assertEquals(
- "<span class=\"context-left\"></span><mark><mark class=\"class-7 level-0\"><mark class=\"class-5 level-1\">a<mark class=\"class-6 level-2\">b</mark></mark></mark><mark class=\"class-6 level-2\">c</mark></mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark><mark class=\"class-7 level-0\"><mark class=\"class-5 level-1\">a<mark class=\"class-6 level-2\">b</mark></mark></mark><mark class=\"class-6 level-2\">c</mark></mark></span><span class=\"context-right\"></span>",
km.getSnippetHTML());
};
@@ -185,23 +185,23 @@
.or(kq._(2, kq.seg("s:b"))).toQuery();
Result kr = ki.search(q);
assertEquals((long) 14, kr.getTotalResults());
- assertEquals("[{1:a}]bab", kr.getMatch(0).getSnippetBrackets());
- assertEquals("a[{2:b}]ab", kr.getMatch(1).getSnippetBrackets());
- assertEquals("ab[{1:a}]b", kr.getMatch(2).getSnippetBrackets());
- assertEquals("aba[{2:b}]", kr.getMatch(3).getSnippetBrackets());
+ assertEquals("[[{1:a}]]bab", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("a[[{2:b}]]ab", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("ab[[{1:a}]]b", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("aba[[{2:b}]]", kr.getMatch(3).getSnippetBrackets());
- assertEquals("[{1:a}]ba", kr.getMatch(4).getSnippetBrackets());
- assertEquals("a[{2:b}]a", kr.getMatch(5).getSnippetBrackets());
- assertEquals("ab[{1:a}]", kr.getMatch(6).getSnippetBrackets());
+ assertEquals("[[{1:a}]]ba", kr.getMatch(4).getSnippetBrackets());
+ assertEquals("a[[{2:b}]]a", kr.getMatch(5).getSnippetBrackets());
+ assertEquals("ab[[{1:a}]]", kr.getMatch(6).getSnippetBrackets());
- assertEquals("[{1:a}]bab", kr.getMatch(7).getSnippetBrackets());
- assertEquals("a[{2:b}]ab", kr.getMatch(8).getSnippetBrackets());
- assertEquals("ab[{1:a}]b", kr.getMatch(9).getSnippetBrackets());
- assertEquals("aba[{2:b}]", kr.getMatch(10).getSnippetBrackets());
+ assertEquals("[[{1:a}]]bab", kr.getMatch(7).getSnippetBrackets());
+ assertEquals("a[[{2:b}]]ab", kr.getMatch(8).getSnippetBrackets());
+ assertEquals("ab[[{1:a}]]b", kr.getMatch(9).getSnippetBrackets());
+ assertEquals("aba[[{2:b}]]", kr.getMatch(10).getSnippetBrackets());
- assertEquals("[{1:a}]ba", kr.getMatch(11).getSnippetBrackets());
- assertEquals("a[{2:b}]a", kr.getMatch(12).getSnippetBrackets());
- assertEquals("ab[{1:a}]", kr.getMatch(13).getSnippetBrackets());
+ assertEquals("[[{1:a}]]ba", kr.getMatch(11).getSnippetBrackets());
+ assertEquals("a[[{2:b}]]a", kr.getMatch(12).getSnippetBrackets());
+ assertEquals("ab[[{1:a}]]", kr.getMatch(13).getSnippetBrackets());
kq = new QueryBuilder("base");
q = (SpanQuery) kq.or(kq._(1, kq.seg("i:a")))
@@ -212,32 +212,32 @@
kr = ki.search(qs);
assertEquals((long) 10, kr.getTotalResults());
- assertEquals("[{1:a}]b ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("... b[{2:a}]b", kr.getMatch(1).getSnippetBrackets());
- assertEquals("... a[{1:b}]", kr.getMatch(2).getSnippetBrackets());
- assertEquals("[{1:a}]b ...", kr.getMatch(3).getSnippetBrackets());
- assertEquals("... b[{2:a}]", kr.getMatch(4).getSnippetBrackets());
- assertEquals("[{1:a}]b ...", kr.getMatch(5).getSnippetBrackets());
- assertEquals("... b[{2:a}]b", kr.getMatch(6).getSnippetBrackets());
- assertEquals("... a[{1:b}]", kr.getMatch(7).getSnippetBrackets());
- assertEquals("[{1:a}]b ...", kr.getMatch(8).getSnippetBrackets());
- assertEquals("... b[{2:a}]", kr.getMatch(9).getSnippetBrackets());
+ assertEquals("[[{1:a}]]b ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("... b[[{2:a}]]b", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("... a[[{1:b}]]", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("[[{1:a}]]b ...", kr.getMatch(3).getSnippetBrackets());
+ assertEquals("... b[[{2:a}]]", kr.getMatch(4).getSnippetBrackets());
+ assertEquals("[[{1:a}]]b ...", kr.getMatch(5).getSnippetBrackets());
+ assertEquals("... b[[{2:a}]]b", kr.getMatch(6).getSnippetBrackets());
+ assertEquals("... a[[{1:b}]]", kr.getMatch(7).getSnippetBrackets());
+ assertEquals("[[{1:a}]]b ...", kr.getMatch(8).getSnippetBrackets());
+ assertEquals("... b[[{2:a}]]", kr.getMatch(9).getSnippetBrackets());
qs.getMeta().getContext().left.setToken(true).setLength((short) 0);
qs.getMeta().getContext().right.setToken(true).setLength((short) 0);
kr = ki.search(qs);
assertEquals((long) 10, kr.getTotalResults());
- assertEquals("[{1:a}] ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("... [{2:a}] ...", kr.getMatch(1).getSnippetBrackets());
- assertEquals("... [{1:b}]", kr.getMatch(2).getSnippetBrackets());
- assertEquals("[{1:a}] ...", kr.getMatch(3).getSnippetBrackets());
- assertEquals("... [{2:a}]", kr.getMatch(4).getSnippetBrackets());
- assertEquals("[{1:a}] ...", kr.getMatch(5).getSnippetBrackets());
- assertEquals("... [{2:a}] ...", kr.getMatch(6).getSnippetBrackets());
- assertEquals("... [{1:b}]", kr.getMatch(7).getSnippetBrackets());
- assertEquals("[{1:a}] ...", kr.getMatch(8).getSnippetBrackets());
- assertEquals("... [{2:a}]", kr.getMatch(9).getSnippetBrackets());
+ assertEquals("[[{1:a}]] ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("... [[{2:a}]] ...", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("... [[{1:b}]]", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("[[{1:a}]] ...", kr.getMatch(3).getSnippetBrackets());
+ assertEquals("... [[{2:a}]]", kr.getMatch(4).getSnippetBrackets());
+ assertEquals("[[{1:a}]] ...", kr.getMatch(5).getSnippetBrackets());
+ assertEquals("... [[{2:a}]] ...", kr.getMatch(6).getSnippetBrackets());
+ assertEquals("... [[{1:b}]]", kr.getMatch(7).getSnippetBrackets());
+ assertEquals("[[{1:a}]] ...", kr.getMatch(8).getSnippetBrackets());
+ assertEquals("... [[{2:a}]]", kr.getMatch(9).getSnippetBrackets());
q = (SpanQuery) kq._(3,
kq.or(kq._(1, kq.seg("i:a"))).or(kq._(2, kq.seg("i:c"))))
@@ -248,16 +248,16 @@
kr = ki.search(qs);
assertEquals((long) 10, kr.getTotalResults());
- assertEquals("[{3:{1:a}}] ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("... [{3:{2:a}}] ...", kr.getMatch(1).getSnippetBrackets());
- assertEquals("... [{3:{1:b}}]", kr.getMatch(2).getSnippetBrackets());
- assertEquals("[{3:{1:a}}] ...", kr.getMatch(3).getSnippetBrackets());
- assertEquals("... [{3:{2:a}}]", kr.getMatch(4).getSnippetBrackets());
- assertEquals("[{3:{1:a}}] ...", kr.getMatch(5).getSnippetBrackets());
- assertEquals("... [{3:{2:a}}] ...", kr.getMatch(6).getSnippetBrackets());
- assertEquals("... [{3:{1:b}}]", kr.getMatch(7).getSnippetBrackets());
- assertEquals("[{3:{1:a}}] ...", kr.getMatch(8).getSnippetBrackets());
- assertEquals("... [{3:{2:a}}]", kr.getMatch(9).getSnippetBrackets());
+ assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("... [[{3:{2:a}}]] ...", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("... [[{3:{1:b}}]]", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(3).getSnippetBrackets());
+ assertEquals("... [[{3:{2:a}}]]", kr.getMatch(4).getSnippetBrackets());
+ assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(5).getSnippetBrackets());
+ assertEquals("... [[{3:{2:a}}]] ...", kr.getMatch(6).getSnippetBrackets());
+ assertEquals("... [[{3:{1:b}}]]", kr.getMatch(7).getSnippetBrackets());
+ assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(8).getSnippetBrackets());
+ assertEquals("... [[{3:{2:a}}]]", kr.getMatch(9).getSnippetBrackets());
};
@@ -285,10 +285,10 @@
assertEquals(kr.getStartIndex(), 0);
assertEquals(
kr.getMatch(0).getSnippetBrackets(),
- "... 2. Herkunft Die aus dem proto-semitischen [{15:Alphabet}] stammende Urform des Buchstaben ist wahrscheinlich ...");
+ "... 2. Herkunft Die aus dem proto-semitischen [[{15:Alphabet}]] stammende Urform des Buchstaben ist wahrscheinlich ...");
assertEquals(
kr.getMatch(0).getSnippetHTML(),
- "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><mark><mark class=\"class-15 level-0\">Alphabet</mark></mark><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
+ "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><mark><mark class=\"class-15 level-0\">Alphabet</mark></mark></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
json = getString(getClass().getResource(
"/queries/bugs/greater_highlights_16.jsonld").getFile());
@@ -301,10 +301,10 @@
assertEquals(kr.getStartIndex(), 0);
assertEquals(
kr.getMatch(0).getSnippetBrackets(),
- "... 2. Herkunft Die aus dem proto-semitischen [{16:Alphabet}] stammende Urform des Buchstaben ist wahrscheinlich ...");
+ "... 2. Herkunft Die aus dem proto-semitischen [[{16:Alphabet}]] stammende Urform des Buchstaben ist wahrscheinlich ...");
assertEquals(
kr.getMatch(0).getSnippetHTML(),
- "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><mark><mark class=\"class-16 level-0\">Alphabet</mark></mark><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
+ "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><mark><mark class=\"class-16 level-0\">Alphabet</mark></mark></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
// 127
json = getString(getClass().getResource(
@@ -317,10 +317,10 @@
assertEquals(kr.getStartIndex(), 0);
assertEquals(
kr.getMatch(0).getSnippetBrackets(),
- "... 2. Herkunft Die aus dem proto-semitischen [{127:Alphabet}] stammende Urform des Buchstaben ist wahrscheinlich ...");
+ "... 2. Herkunft Die aus dem proto-semitischen [[{127:Alphabet}]] stammende Urform des Buchstaben ist wahrscheinlich ...");
assertEquals(
kr.getMatch(0).getSnippetHTML(),
- "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><mark><mark class=\"class-127 level-0\">Alphabet</mark></mark><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
+ "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><mark><mark class=\"class-127 level-0\">Alphabet</mark></mark></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
// 255
json = getString(getClass().getResource(
@@ -333,10 +333,10 @@
assertEquals(kr.getStartIndex(), 0);
assertEquals(
kr.getMatch(0).getSnippetBrackets(),
- "... 2. Herkunft Die aus dem proto-semitischen [Alphabet] stammende Urform des Buchstaben ist wahrscheinlich ...");
+ "... 2. Herkunft Die aus dem proto-semitischen [[Alphabet]] stammende Urform des Buchstaben ist wahrscheinlich ...");
assertEquals(
kr.getMatch(0).getSnippetHTML(),
- "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><mark>Alphabet</mark><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
+ "<span class=\"context-left\"><span class=\"more\"></span>2. Herkunft Die aus dem proto-semitischen </span><span class=\"match\"><mark>Alphabet</mark></span><span class=\"context-right\"> stammende Urform des Buchstaben ist wahrscheinlich<span class=\"more\"></span></span>");
// 300
json = getString(getClass().getResource(
@@ -380,14 +380,14 @@
Result kr = ki.search(qs);
assertEquals((long) 1, kr.getTotalResults());
- assertEquals("[Mit \"Mann\" & \\{Ma\\\\us\\}]", kr.getMatch(0).getSnippetBrackets());
- assertEquals("<span class=\"context-left\"></span><mark>Mit "Mann" & {Ma\\us}</mark><span class=\"context-right\"></span>", kr.getMatch(0).getSnippetHTML());
+ assertEquals("[[Mit \"Mann\" & \\{Ma\\\\us\\}]]", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("<span class=\"context-left\"></span><span class=\"match\"><mark>Mit "Mann" & {Ma\\us}</mark></span><span class=\"context-right\"></span>", kr.getMatch(0).getSnippetHTML());
assertEquals("match-c1/d1/1-p0-4", kr.getMatch(0).getID());
Match km = ki.getMatchInfo("match-c1/d1/1-p0-4", "base", true, (ArrayList) null, (ArrayList) null, true, true, false);
assertEquals(0, km.getStartPos());
assertEquals("<span class=\"context-left\"></span>"+
- "<mark><span title=\"base/t:t\">"+
+ "<span class=\"match\"><mark><span title=\"base/t:t\">"+
"Mit "+
"<span title=\"base/l:"Mann"\">"+
""Mann""+
@@ -397,7 +397,7 @@
" "+
"{Ma\\us}"+
"</span>"+
- "</mark>"+
+ "</mark></span>"+
"<span class=\"context-right\"></span>",
km.getSnippetHTML());
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestClassFilterIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestClassFilterIndex.java
index 4abea57..e15c3d1 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestClassFilterIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestClassFilterIndex.java
@@ -51,24 +51,24 @@
assertEquals(1, kr.getMatch(0).getStartPos());
assertEquals(5, kr.getMatch(0).getEndPos());
assertEquals(
- "Frankenstein, [{2:treat {1:my daughter} well}]. She is the one that saved ...",
+ "Frankenstein, [[{2:treat {1:my daughter} well}]]. She is the one that saved ...",
kr.getMatch(0).getSnippetBrackets());
assertEquals(6, kr.getMatch(1).getStartPos());
assertEquals(18, kr.getMatch(1).getEndPos());
assertEquals(
- "Frankenstein, treat my daughter well. She [{2:is {1:the one} that saved "
- + "your master who you hold so dear}].", kr.getMatch(1)
+ "Frankenstein, treat my daughter well. She [[{2:is {1:the one} that saved "
+ + "your master who you hold so dear}]].", kr.getMatch(1)
.getSnippetBrackets());
assertEquals(
- "Frankenstein, treat my daughter well. She [{2:is {1:the one that "
- + "saved your master who you hold so dear}}].", kr
+ "Frankenstein, treat my daughter well. She [[{2:is {1:the one that "
+ + "saved your master who you hold so dear}}]].", kr
.getMatch(2).getSnippetBrackets());
assertEquals(
- "Frankenstein, treat my daughter well. She [{2:is the one that "
- + "saved {1:your master} who you hold so dear}].", kr
+ "Frankenstein, treat my daughter well. She [[{2:is the one that "
+ + "saved {1:your master} who you hold so dear}]].", kr
.getMatch(3).getSnippetBrackets());
assertEquals(
- "Frankenstein, treat my daughter well. She [{2:is the one that saved your master who {1:you} hold so dear}].",
+ "Frankenstein, treat my daughter well. She [[{2:is the one that saved your master who {1:you} hold so dear}]].",
kr.getMatch(4).getSnippetBrackets());
}
@@ -107,19 +107,19 @@
assertEquals(5, kr.getMatch(0).getEndPos());
assertEquals(
- "[{1:Frankenstein}, {2:treat my daughter well}]. She is the one that saved ...",
+ "[[{1:Frankenstein}, {2:treat my daughter well}]]. She is the one that saved ...",
kr.getMatch(0).getSnippetBrackets());
assertEquals(1, kr.getMatch(1).getStartPos());
assertEquals(6, kr.getMatch(1).getEndPos());
assertEquals(
- "Frankenstein, [{2:treat my daughter well}. {1:She}] is the one that saved your ...",
+ "Frankenstein, [[{2:treat my daughter well}. {1:She}]] is the one that saved your ...",
kr.getMatch(1).getSnippetBrackets());
assertEquals(5, kr.getMatch(2).getStartPos());
assertEquals(18, kr.getMatch(2).getEndPos());
assertEquals(
- "Frankenstein, treat my daughter well. [{1:She} {2:is the one that saved your master who you hold so dear}].",
+ "Frankenstein, treat my daughter well. [[{1:She} {2:is the one that saved your master who you hold so dear}]].",
kr.getMatch(2).getSnippetBrackets());
}
@@ -186,13 +186,13 @@
assertEquals(0, kr.getMatch(0).getStartPos());
assertEquals(3, kr.getMatch(0).getEndPos());
assertEquals(
- "[{1:Frankenstein}, treat {2:my}] daughter well. She is the one ...",
+ "[[{1:Frankenstein}, treat {2:my}]] daughter well. She is the one ...",
kr.getMatch(0).getSnippetBrackets());
assertEquals(5, kr.getMatch(3).getStartPos());
assertEquals(9, kr.getMatch(3).getEndPos());
assertEquals(
- "Frankenstein, treat my daughter well. [{2:She} is {1:the one}] that saved your master who you ...",
+ "Frankenstein, treat my daughter well. [[{2:She} is {1:the one}]] that saved your master who you ...",
kr.getMatch(3).getSnippetBrackets());
// she is both prp and np
}
@@ -242,12 +242,12 @@
assertEquals(0, kr.getMatch(0).getStartPos());
assertEquals(3, kr.getMatch(0).getEndPos());
assertEquals(
- "[{1:Frankenstein, {2:{3:treat}}}{2: my}] daughter well. She is the one ...",
+ "[[{1:Frankenstein, {2:{3:treat}}}{2: my}]] daughter well. She is the one ...",
kr.getMatch(0).getSnippetBrackets());
assertEquals(1, kr.getMatch(1).getStartPos());
assertEquals(4, kr.getMatch(1).getEndPos());
assertEquals(
- "Frankenstein, [{1:{2:{3:treat} my} daughter}] well. She is the one that ...",
+ "Frankenstein, [[{1:{2:{3:treat} my} daughter}]] well. She is the one that ...",
kr.getMatch(1).getSnippetBrackets());
}
@@ -296,7 +296,7 @@
assertEquals(6, kr.getMatch(0).getStartPos());
assertEquals(18, kr.getMatch(0).getEndPos());
assertEquals(
- "Frankenstein, treat my daughter well. She [{2:is the {1:one} that saved {1:your} master who you hold so dear}].",
+ "Frankenstein, treat my daughter well. She [[{2:is the {1:one} that saved {1:your} master who you hold so dear}]].",
kr.getMatch(0).getSnippetBrackets());
}
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
index c44e4fd..2268d5b 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestClassIndex.java
@@ -47,12 +47,12 @@
assertEquals("totalResults", kr.getTotalResults(), 1);
assertEquals("StartPos (0)", 7, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 9, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "... bcabca[ba]c", kr.getMatch(0)
+ assertEquals("SnippetBrackets (0)", "... bcabca[[ba]]c", kr.getMatch(0)
.getSnippetBrackets());
assertEquals(
"SnippetHTML (0)",
"<span class=\"context-left\"><span class=\"more\">"
- + "</span>bcabca</span><mark>ba</mark><span class=\"context-right"
+ + "</span>bcabca</span><span class=\"match\"><mark>ba</mark></span><span class=\"context-right"
+ "\">c</span>", kr.getMatch(0).getSnippetHTML());
sq = new SpanTermQuery(new Term("base", "s:b"));
@@ -61,23 +61,23 @@
assertEquals("totalResults", kr.getTotalResults(), 3);
assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "a[b]cabcab ...", kr.getMatch(0)
+ assertEquals("SnippetBrackets (0)", "a[[b]]cabcab ...", kr.getMatch(0)
.getSnippetBrackets());
assertEquals(
"SnippetHTML (0)",
- "<span class=\"context-left\">a</span><mark>"
- + "b</mark><span class=\"context-right\">cabcab<span class=\"more\"></span></span>",
+ "<span class=\"context-left\">a</span><span class=\"match\"><mark>"
+ + "b</mark></span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>",
kr.getMatch(0).getSnippetHTML());
assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
- assertEquals("SnippetBrackets (1)", "abca[b]cabac", kr.getMatch(1)
+ assertEquals("SnippetBrackets (1)", "abca[[b]]cabac", kr.getMatch(1)
.getSnippetBrackets());
assertEquals("StartPos (2)", 7, kr.getMatch(2).startPos);
assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
- assertEquals("SnippetBrackets (2)", "... bcabca[b]ac", kr.getMatch(2)
+ assertEquals("SnippetBrackets (2)", "... bcabca[[b]]ac", kr.getMatch(2)
.getSnippetBrackets());
sq = new SpanClassQuery(new SpanTermQuery(new Term("base", "s:b")));
@@ -86,23 +86,23 @@
assertEquals("totalResults", kr.getTotalResults(), 3);
assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
- assertEquals("snippetBrackets (0)", "a[{1:b}]cabcab ...", kr
+ assertEquals("snippetBrackets (0)", "a[[{1:b}]]cabcab ...", kr
.getMatch(0).getSnippetBrackets());
assertEquals(
"snippetHTML (0)",
- "<span class=\"context-left\">a</span><mark>"
- + "<mark class=\"class-1 level-0\">b</mark></mark><span class=\"context-right\">cabcab<span "
+ "<span class=\"context-left\">a</span><span class=\"match\"><mark>"
+ + "<mark class=\"class-1 level-0\">b</mark></mark></span><span class=\"context-right\">cabcab<span "
+ "class=\"more\"></span></span>", kr.getMatch(0)
.getSnippetHTML());
assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
- assertEquals("snippetBrackets (1)", "abca[{1:b}]cabac", kr.getMatch(1)
+ assertEquals("snippetBrackets (1)", "abca[[{1:b}]]cabac", kr.getMatch(1)
.getSnippetBrackets());
assertEquals("StartPos (2)", 7, kr.getMatch(2).startPos);
assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
- assertEquals("snippetBrackets (2)", "... bcabca[{1:b}]ac",
+ assertEquals("snippetBrackets (2)", "... bcabca[[{1:b}]]ac",
kr.getMatch(2).getSnippetBrackets());
@@ -115,21 +115,21 @@
assertEquals("totalResults", kr.getTotalResults(), 3);
assertEquals("StartPos (0)", 0, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "[a{1:b}]cabcab ...", kr
+ assertEquals("SnippetBrackets (0)", "[[a{1:b}]]cabcab ...", kr
.getMatch(0).getSnippetBrackets());
assertEquals(
"SnippetHTML (0)",
- "<span class=\"context-left\"></span><mark>a<mark class=\"class-1 level-0\">b</mark></mark><span class=\"context-right\">cabcab<span class=\"more\"></span></span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark>a<mark class=\"class-1 level-0\">b</mark></mark></span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>",
kr.getMatch(0).getSnippetHTML());
assertEquals("StartPos (1)", 3, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
- assertEquals("SnippetBrackets (1)", "abc[a{1:b}]cabac", kr.getMatch(1)
+ assertEquals("SnippetBrackets (1)", "abc[[a{1:b}]]cabac", kr.getMatch(1)
.getSnippetBrackets());
assertEquals("StartPos (2)", 6, kr.getMatch(2).startPos);
assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
- assertEquals("SnippetBrackets (2)", "abcabc[a{1:b}]ac", kr.getMatch(2)
+ assertEquals("SnippetBrackets (2)", "abcabc[[a{1:b}]]ac", kr.getMatch(2)
.getSnippetBrackets());
@@ -142,16 +142,16 @@
assertEquals("StartPos (0)", 0, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "[{2:a}{3:b}]cabcab ...", kr
+ assertEquals("SnippetBrackets (0)", "[[{2:a}{3:b}]]cabcab ...", kr
.getMatch(0).getSnippetBrackets());
assertEquals("StartPos (1)", 3, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
- assertEquals("SnippetBrackets (1)", "abc[{2:a}{3:b}]cabac", kr
+ assertEquals("SnippetBrackets (1)", "abc[[{2:a}{3:b}]]cabac", kr
.getMatch(1).getSnippetBrackets());
assertEquals("StartPos (2)", 6, kr.getMatch(2).startPos);
assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
- assertEquals("SnippetBrackets (2)", "abcabc[{2:a}{3:b}]ac", kr
+ assertEquals("SnippetBrackets (2)", "abcabc[[{2:a}{3:b}]]ac", kr
.getMatch(2).getSnippetBrackets());
// abcabcabac
@@ -163,31 +163,31 @@
kr = ki.search(sq, (short) 10);
assertEquals("totalResults", kr.getTotalResults(), 1);
- assertEquals("SnippetBrackets (0)", "abcabc[a{2:b{1:a}}]c", kr
+ assertEquals("SnippetBrackets (0)", "abcabc[[a{2:b{1:a}}]]c", kr
.getMatch(0).getSnippetBrackets());
assertEquals(
"SnippetHTML (0)",
- "<span class=\"context-left\">abcabc</span><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\">c</span>",
+ "<span class=\"context-left\">abcabc</span><span class=\"match\"><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\">c</span>",
kr.getMatch(0).getSnippetHTML());
// Offset tokens
kr = ki.search(sq, 0, (short) 10, true, (short) 2, true, (short) 2);
assertEquals("totalResults", kr.getTotalResults(), 1);
- assertEquals("SnippetBrackets (0)", "... bc[a{2:b{1:a}}]c", kr
+ assertEquals("SnippetBrackets (0)", "... bc[[a{2:b{1:a}}]]c", kr
.getMatch(0).getSnippetBrackets());
assertEquals(
"SnippetHTML (0)",
- "<span class=\"context-left\"><span class=\"more\"></span>bc</span><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\">c</span>",
+ "<span class=\"context-left\"><span class=\"more\"></span>bc</span><span class=\"match\"><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\">c</span>",
kr.getMatch(0).getSnippetHTML());
// Offset Characters
kr = ki.search(sq, 0, (short) 10, false, (short) 2, false, (short) 2);
assertEquals("totalResults", kr.getTotalResults(), 1);
- assertEquals("SnippetBrackets (0)", "... bc[a{2:b{1:a}}]c", kr
+ assertEquals("SnippetBrackets (0)", "... bc[[a{2:b{1:a}}]]c", kr
.getMatch(0).getSnippetBrackets());
assertEquals(
"SnippetHTML (0)",
- "<span class=\"context-left\"><span class=\"more\"></span>bc</span><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\">c</span>",
+ "<span class=\"context-left\"><span class=\"more\"></span>bc</span><span class=\"match\"><mark>a<mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\">c</span>",
kr.getMatch(0).getSnippetHTML());
@@ -245,8 +245,7 @@
SpanQuery sq;
Result kr;
-
- /*
+/*
sq = new SpanNextQuery(
new SpanTermQuery(new Term("base", "s:c")),
new SpanElementQuery("base", "x")
@@ -254,10 +253,9 @@
kr = ki.search(sq, (short) 10);
assertEquals("ab[cabca]bac", kr.getMatch(0).getSnippetBrackets());
- System.err.println();
- */
-
+*/
/*
+ System.err.println();
sq = new SpanNextQuery(
new SpanElementQuery("base", "x"),
new SpanTermQuery(new Term("base", "s:b"))
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
index f63f299..21f8ba7 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
@@ -231,7 +231,7 @@
kr = ki.search(sqwi.toQuery(), (short) 10);
assertEquals(kr.getTotalResults(), 1);
- assertEquals("[ecebdc]", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("[[ecebdc]]", kr.getMatch(0).getSnippetBrackets());
sqwi = jsonQuery(getClass().getResource(
"/queries/distances/in-same-t.jsonld").getFile());
@@ -242,7 +242,7 @@
kr = ki.search(sqwi.toQuery(), (short) 10);
assertEquals(1, kr.getTotalResults()); // Is 1 correct or should it not be ordered?
- assertEquals("[ec]ebdc", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("[[ec]]ebdc", kr.getMatch(0).getSnippetBrackets());
};
public static String getString (String path) {
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
index 48850e5..3c83f4f 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
@@ -239,9 +239,9 @@
Result kr = ki.search(sq, 0, (short) 15, false, (short) 3, false,
(short) 3);
- assertEquals("... ccc[222222]fff ...", kr.getMatch(0)
+ assertEquals("... ccc[[222222]]fff ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... fff[333333]iii ...", kr.getMatch(1)
+ assertEquals("... fff[[333333]]iii ...", kr.getMatch(1)
.getSnippetBrackets());
};
@@ -276,10 +276,10 @@
Result kr = ki.search(sq, 0, (short) 15, false, (short) 3, false,
(short) 3);
- assertEquals("[111111]ccc ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("... ccc[222222]fff ...", kr.getMatch(1)
+ assertEquals("[[111111]]ccc ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("... ccc[[222222]]fff ...", kr.getMatch(1)
.getSnippetBrackets());
- assertEquals("... fff[333333]iii ...", kr.getMatch(2)
+ assertEquals("... fff[[333333]]iii ...", kr.getMatch(2)
.getSnippetBrackets());
};
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 71532e0..0112f40 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -136,7 +136,7 @@
assertEquals(km.getPubPlace(), "Bochum");
assertEquals(km.getPubDate().toDisplay(), "2013-06-17");
- assertEquals(km.getSnippetBrackets(), "a[{3:b}]c");
+ assertEquals(km.getSnippetBrackets(), "a[[{3:b}]]c");
};
@@ -177,7 +177,7 @@
meta.getContext().right.setToken(true).setLength(6);
assertEquals(
- "... okal. [Der Buchstabe A hat in {1:deutschen Texten} eine durchschnittliche Häufigkeit von 6,51 %.] Er ist damit der sechsthäufigste Buchstabe ...",
+ "... okal. [[Der Buchstabe A hat in {1:deutschen Texten} eine durchschnittliche Häufigkeit von 6,51 %.]] Er ist damit der sechsthäufigste Buchstabe ...",
ks.apply(ki).getMatch(0).getSnippetBrackets());
};
@@ -206,7 +206,7 @@
false, (short) 5);
assertEquals(1, kr.getTotalResults());
- assertEquals("... bezeichnen, sofern [{1:der} schwedische Buchstabe „Å“ nicht] verfügbar ist im SI-Einheitensystem ist ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("... bezeichnen, sofern [[{1:der} schwedische Buchstabe „Å“ nicht]] verfügbar ist im SI-Einheitensystem ist ...", kr.getMatch(0).getSnippetBrackets());
};
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 8b1985f..ba13544 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -127,7 +127,7 @@
Match km = kr.getMatch(0);
- assertEquals("SnippetBrackets (0)", "... bcabca[{2:b{1:a}}]c",
+ assertEquals("SnippetBrackets (0)", "... bcabca[[{2:b{1:a}}]]c",
km.getSnippetBrackets());
assertEquals("ID (0)", "match-c1!d1-p7-9(2)7-8(1)8-8", km.getID());
};
@@ -144,7 +144,7 @@
assertEquals("StartPos (0)", 7, km.getStartPos());
assertEquals("EndPos (0)", 9, km.getEndPos());
- assertEquals("SnippetBrackets (0)", "... [{2:b{a}}] ...",
+ assertEquals("SnippetBrackets (0)", "... [[{2:b{a}}]] ...",
km.getSnippetBrackets());
assertEquals("ID (0)", "match-c1!d1-p7-9(0)8-8(2)7-8", km.getID());
@@ -153,27 +153,27 @@
"m", false, false);
assertEquals("SnippetBrackets (1)",
- "... [{f/m:acht:b}{f/m:neun:a}] ...", km.getSnippetBrackets());
+ "... [[{f/m:acht:b}{f/m:neun:a}]] ...", km.getSnippetBrackets());
km = ki.getMatchInfo("match-c1!d1-p7-9(0)8-8(2)7-8", "tokens", "f",
null, false, false);
assertEquals("SnippetBrackets (1b)",
- "... [{f/m:acht:{f/y:eight:b}}{f/m:neun:{f/y:nine:a}}] ...",
+ "... [[{f/m:acht:{f/y:eight:b}}{f/m:neun:{f/y:nine:a}}]] ...",
km.getSnippetBrackets());
km = ki.getMatchInfo("match-c1!d1-p7-9(0)8-8(2)7-8", "tokens", "f",
"m", false, true);
assertEquals("SnippetBrackets (2)",
- "... [{2:{f/m:acht:b}{{f/m:neun:a}}}] ...",
+ "... [[{2:{f/m:acht:b}{{f/m:neun:a}}}]] ...",
km.getSnippetBrackets());
km = ki.getMatchInfo("match-c1!d1-p7-9(4)8-8(2)7-8", "tokens", "f",
"m", false, true);
assertEquals("SnippetBrackets (3)",
- "... [{2:{f/m:acht:b}{4:{f/m:neun:a}}}] ...",
+ "... [[{2:{f/m:acht:b}{4:{f/m:neun:a}}}]] ...",
km.getSnippetBrackets());
km = ki.getMatchInfo("match-c1!d1-p7-9(4)8-8(2)7-8", "tokens", "f",
@@ -181,18 +181,19 @@
assertEquals(
"SnippetBrackets (4)",
- "... [{2:{f/m:acht:{f/y:eight:b}}{4:{f/m:neun:{f/y:nine:a}}}}] ...",
+ "... [[{2:{f/m:acht:{f/y:eight:b}}{4:{f/m:neun:{f/y:nine:a}}}}]] ...",
km.getSnippetBrackets());
assertEquals("SnippetHTML (4)", "<span class=\"context-left\">"
- + "<span class=\"more\">" + "</span>" + "</span>" + "<mark>"
+ + "<span class=\"more\">" + "</span>" + "</span>" +
+ "<span class=\"match\">" + "<mark>"
+ "<mark class=\"class-2 level-0\">"
+ "<span title=\"f/m:acht\">" + "<span title=\"f/y:eight\">"
+ "b" + "</span>" + "</span>"
+ "<mark class=\"class-4 level-1\">"
+ "<span title=\"f/m:neun\">" + "<span title=\"f/y:nine\">"
+ "a" + "</span>" + "</span>" + "</mark>" + "</mark>"
- + "</mark>" + "<span class=\"context-right\">"
+ + "</mark>" + "</span>" + "<span class=\"context-right\">"
+ "<span class=\"more\">" + "</span>" + "</span>",
km.getSnippetHTML());
@@ -219,7 +220,7 @@
assertEquals("SnippetHTML (1)", "<span class=\"context-left\">"
- + "<span class=\"more\">" + "</span>" + "</span>" + "<mark>"
+ + "<span class=\"more\">" + "</span>" + "</span>" + "<span class=\"match\">" + "<mark>"
+ "<mark class=\"class-2 level-0\">"
+ "<span title=\"f/m:acht\">" + "<span title=\"f/y:eight\">"
+ "<span title=\"it/is:8\">" + "<span title=\"x/o:achtens\">"
@@ -228,7 +229,7 @@
+ "<span title=\"f/m:neun\">" + "<span title=\"f/y:nine\">"
+ "<span title=\"it/is:9\">" + "<span title=\"x/o:neuntens\">"
+ "a" + "</span>" + "</span>" + "</span>" + "</span>"
- + "</mark>" + "</mark>" + "</mark>"
+ + "</mark>" + "</mark>" + "</mark>" + "</span>"
+ "<span class=\"context-right\">" + "<span class=\"more\">"
+ "</span>" + "</span>", km.getSnippetHTML());
};
@@ -245,14 +246,14 @@
assertEquals("SnippetHTML (1)", "<span class=\"context-left\">"
- + "<span class=\"more\">" + "</span>" + "</span>" + "<mark>"
+ + "<span class=\"more\">" + "</span>" + "</span>" + "<span class=\"match\">" + "<mark>"
+ "<span title=\"f/m:acht\">" + "<span title=\"f/y:eight\">"
+ "<span title=\"it/is:8\">" + "<span title=\"x/o:achtens\">"
+ "b" + "</span>" + "</span>" + "</span>" + "</span>"
+ "<span title=\"f/m:neun\">" + "<span title=\"f/y:nine\">"
+ "<span title=\"it/is:9\">" + "<span title=\"x/o:neuntens\">"
+ "a" + "</span>" + "</span>" + "</span>" + "</span>"
- + "</mark>" + "<span class=\"context-right\">"
+ + "</mark>" + "</span>" + "<span class=\"context-right\">"
+ "<span class=\"more\">" + "</span>" + "</span>",
km.getSnippetHTML());
};
@@ -286,7 +287,7 @@
assertEquals(
"SnippetBrackets (1)",
- "... [{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}] ...",
+ "... [[{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}]] ...",
km.getSnippetBrackets());
};
@@ -303,7 +304,7 @@
assertEquals(
"SnippetBrackets (1)",
- "... [{x/tag:{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}{f/m:zehn:{f/y:ten:{it/is:10:{x/o:zehntens:c}}}}}]",
+ "... [[{x/tag:{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}{f/m:zehn:{f/y:ten:{it/is:10:{x/o:zehntens:c}}}}}]]",
km.getSnippetBrackets());
};
@@ -320,11 +321,12 @@
assertEquals(
"SnippetBrackets (1)",
- "... [{x/tag:{2:{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{4:{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}}}{f/m:zehn:{f/y:ten:{it/is:10:{x/o:zehntens:c}}}}}]",
+ "... [[{x/tag:{2:{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{4:{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}}}{f/m:zehn:{f/y:ten:{it/is:10:{x/o:zehntens:c}}}}}]]",
km.getSnippetBrackets());
assertEquals("SnippetHTML (1)", "<span class=\"context-left\">"
- + "<span class=\"more\">" + "</span>" + "</span>" + "<mark>"
+ + "<span class=\"more\">" + "</span>" + "</span>" +
+ "<span class=\"match\">" +"<mark>"
+ "<span title=\"x/tag\">" + "<mark class=\"class-2 level-0\">"
+ "<span title=\"f/m:acht\">" + "<span title=\"f/y:eight\">"
+ "<span title=\"it/is:8\">" + "<span title=\"x/o:achtens\">"
@@ -337,6 +339,7 @@
+ "<span title=\"f/y:ten\">" + "<span title=\"it/is:10\">"
+ "<span title=\"x/o:zehntens\">" + "c" + "</span>" + "</span>"
+ "</span>" + "</span>" + "</span>" + "</mark>"
+ + "</span>"
+ "<span class=\"context-right\">" + "</span>",
km.getSnippetHTML());
};
@@ -353,26 +356,36 @@
assertEquals(
"SnippetBrackets (1)",
- "[{x/rel:a>3:{x/o:erstens:a}}{x/o:zweitens:b}{x/o:drittens:c}{#3:{x/o:viertens:a}}{x/o:fünftens:b}] ...",
+ "[[{x/rel:a>3:{x/o:erstens:a}}{x/o:zweitens:b}{x/o:drittens:c}{#3:{x/o:viertens:a}}{x/o:fünftens:b}]] ...",
km.getSnippetBrackets());
- assertEquals("SnippetBrackets (1)", "<span class=\"context-left\">"
- + "</span>" + "<mark>" + "<span xlink:title=\"x/rel:a\" "
- + "xlink:type=\"simple\" " + "xlink:href=\"#word-c1!d1-p3\">"
- + "<span title=\"x/o:erstens\">" + "a" + "</span>" + "</span>"
- + "<span title=\"x/o:zweitens\">" + "b" + "</span>"
- + "<span title=\"x/o:drittens\">" + "c" + "</span>"
- + "<span xml:id=\"word-c1!d1-p3\">"
- + "<span title=\"x/o:viertens\">" + "a" + "</span>" + "</span>"
- + "<span title=\"x/o:fünftens\">" + "b" + "</span>" + "</mark>"
- + "<span class=\"context-right\">" + "<span class=\"more\">"
- + "</span>" + "</span>", km.getSnippetHTML());
+ assertEquals("SnippetBrackets (1)",
+ "<span class=\"context-left\">"
+ + "</span>"
+ + "<span class=\"match\">"
+ + "<mark>"
+ + "<span xlink:title=\"x/rel:a\" "
+ + "xlink:type=\"simple\" " + "xlink:href=\"#word-c1!d1-p3\">"
+ + "<span title=\"x/o:erstens\">" + "a" + "</span>" + "</span>"
+ + "<span title=\"x/o:zweitens\">" + "b" + "</span>"
+ + "<span title=\"x/o:drittens\">" + "c" + "</span>"
+ + "<span xml:id=\"word-c1!d1-p3\">"
+ + "<span title=\"x/o:viertens\">" + "a" + "</span>"
+ + "</span>"
+ + "<span title=\"x/o:fünftens\">" + "b" + "</span>"
+ + "</mark>"
+ + "</span>"
+ + "<span class=\"context-right\">" + "<span class=\"more\">"
+ + "</span>" +
+ "</span>", km.getSnippetHTML());
km = ki.getMatchInfo("match-c1!d1-p0-5(7)2-3(4)8-8(2)7-8", "tokens",
"x", null, true, true);
assertEquals("SnippetBrackets (1)", "<span class=\"context-left\">"
- + "</span>" + "<mark>" + "<span xlink:title=\"x/rel:a\" "
+ + "</span>" +
+ "<span class=\"match\">" +
+ "<mark>" + "<span xlink:title=\"x/rel:a\" "
+ "xlink:type=\"simple\" " + "xlink:href=\"#word-c1!d1-p3\">"
+ "<span title=\"x/o:erstens\">" + "a" + "</span>" + "</span>"
+ "<span title=\"x/o:zweitens\">" + "b" + "</span>"
@@ -381,7 +394,9 @@
+ "<span xml:id=\"word-c1!d1-p3\">"
+ "<span title=\"x/o:viertens\">" + "a" + "</span>" + "</span>"
+ "</mark>" + "<span title=\"x/o:fünftens\">" + "b" + "</span>"
- + "</mark>" + "<span class=\"context-right\">"
+ + "</mark>" +
+"</span>" +
+ "<span class=\"context-right\">"
+ "<span class=\"more\">" + "</span>" + "</span>",
km.getSnippetHTML());
};
@@ -402,7 +417,7 @@
false);
assertEquals(
- "... [{f/m:vier:{f/y:four:{it/is:4:{x/o:viertens:a}}}}] ...",
+ "... [[{f/m:vier:{f/y:four:{it/is:4:{x/o:viertens:a}}}}]] ...",
km.getSnippetBrackets());
@@ -417,7 +432,7 @@
assertEquals(
"<span class=\"context-left\"></span>"+
- "<mark>"+
+ "<span class=\"match\">" +
"<span title=\"f/m:drei\">"+
"<span title=\"f/y:three\">"+
"<span title=\"it/is:3\">"+
@@ -441,7 +456,7 @@
"</span>"+
"</span>"+
"</span>"+
- "</mark>"+
+ "</span>" +
"<span class=\"context-right\"></span>",
km.getSnippetHTML());
@@ -479,6 +494,7 @@
"SnippetHTML (2)",
"<span class=\"context-left\">"
+ "</span>"
+ + "<span class=\"match\">"
+ "<mark>"
+ "<span xlink:title=\"x/rel:a\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"
+ "<span title=\"f/m:eins\">"
@@ -505,7 +521,8 @@
+ "<span title=\"f/y:four\">"
+ "<span title=\"it/is:4\">"
+ "<span title=\"x/o:viertens\">a</span>" + "</span>"
- + "</span>" + "</span>" + "</span>" + "</mark>"
+ + "</span>" + "</span>" + "</span>" + "</mark>"
+ + "</span>"
+ "<span class=\"context-right\">"
+ "<span class=\"more\">" + "</span>" + "</span>",
km.getSnippetHTML());
@@ -524,20 +541,20 @@
assertEquals(
"f:m info",
km.getSnippetBrackets(),
- "... [{f/m:vier:a}{f/m:fuenf:b}{f/m:sechs:c}{f/m:sieben:a}{f/m:acht:b}{f/m:neun:a}] ...");
+ "... [[{f/m:vier:a}{f/m:fuenf:b}{f/m:sechs:c}{f/m:sieben:a}{f/m:acht:b}{f/m:neun:a}]] ...");
km = ki.getMatchInfo("match-c1!d4-p3-9", "tokens", "f", null, false,
false);
assertEquals(
"f info",
km.getSnippetBrackets(),
- "... [{f/m:vier:{f/y:four:a}}{f/m:fuenf:{f/y:five:b}}{f/m:sechs:{f/y:six:c}}{f/m:sieben:{f/y:seven:a}}{f/m:acht:{f/y:eight:b}}{f/m:neun:{f/y:nine:a}}] ...");
+ "... [[{f/m:vier:{f/y:four:a}}{f/m:fuenf:{f/y:five:b}}{f/m:sechs:{f/y:six:c}}{f/m:sieben:{f/y:seven:a}}{f/m:acht:{f/y:eight:b}}{f/m:neun:{f/y:nine:a}}]] ...");
km = ki.getMatchInfo("match-c1!d4-p3-4", "tokens", null, null, false,
false);
assertEquals("all info", km.getSnippetBrackets(),
- "... [{f/m:vier:{f/y:four:{it/is:4:{x/o:viertens:a}}}}] ...");
+ "... [[{f/m:vier:{f/y:four:{it/is:4:{x/o:viertens:a}}}}]] ...");
ArrayList<String> foundryList = new ArrayList<>(2);
foundryList.add("f");
@@ -546,7 +563,7 @@
km = ki.getMatchInfo("match-c1!d4-p3-4", "tokens", true, foundryList,
(ArrayList<String>) null, false, false, false);
assertEquals("f|x info", km.getSnippetBrackets(),
- "... [{f/m:vier:{f/y:four:{x/o:viertens:a}}}] ...");
+ "... [[{f/m:vier:{f/y:four:{x/o:viertens:a}}}]] ...");
foundryList.clear();
foundryList.add("y");
@@ -555,7 +572,7 @@
km = ki.getMatchInfo("match-c1!d4-p3-4", "tokens", true, foundryList,
(ArrayList<String>) null, false, false, false);
assertEquals("y|x info", km.getSnippetBrackets(),
- "... [{x/o:viertens:a}] ...");
+ "... [[{x/o:viertens:a}]] ...");
foundryList.clear();
@@ -568,7 +585,7 @@
km = ki.getMatchInfo("match-c1!d4-p3-4", "tokens", true, foundryList,
layerList, false, false, false);
assertEquals("f|it/is", km.getSnippetBrackets(),
- "... [{it/is:4:a}] ...");
+ "... [[{it/is:4:a}]] ...");
};
@@ -614,7 +631,7 @@
assertEquals("c1", res.at("/corpusID").asText());
assertEquals("d4", res.at("/docID").asText());
assertEquals(
- "<span class=\"context-left\"><span class=\"more\"></span></span><mark><span title=\"f/m:vier\"><span title=\"f/y:four\"><span title=\"it/is:4\"><span title=\"x/o:viertens\">a</span></span></span></span><span title=\"f/m:fuenf\"><span title=\"f/y:five\"><span title=\"it/is:5\"><span title=\"x/o:fünftens\">b</span></span></span></span><span title=\"f/m:sechs\"><span title=\"f/y:six\"><span title=\"it/is:6\"><span title=\"x/o:sechstens\">c</span></span></span></span><span title=\"f/m:sieben\"><span title=\"f/y:seven\"><span title=\"it/is:7\"><span title=\"x/o:siebtens\">a</span></span></span></span><span title=\"f/m:acht\"><span title=\"f/y:eight\"><span title=\"it/is:8\"><span title=\"x/o:achtens\">b</span></span></span></span><span title=\"f/m:neun\"><span title=\"f/y:nine\"><span title=\"it/is:9\"><span title=\"x/o:neuntens\">a</span></span></span></span></mark><span class=\"context-right\"><span class=\"more\"></span></span>",
+ "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark><span title=\"f/m:vier\"><span title=\"f/y:four\"><span title=\"it/is:4\"><span title=\"x/o:viertens\">a</span></span></span></span><span title=\"f/m:fuenf\"><span title=\"f/y:five\"><span title=\"it/is:5\"><span title=\"x/o:fünftens\">b</span></span></span></span><span title=\"f/m:sechs\"><span title=\"f/y:six\"><span title=\"it/is:6\"><span title=\"x/o:sechstens\">c</span></span></span></span><span title=\"f/m:sieben\"><span title=\"f/y:seven\"><span title=\"it/is:7\"><span title=\"x/o:siebtens\">a</span></span></span></span><span title=\"f/m:acht\"><span title=\"f/y:eight\"><span title=\"it/is:8\"><span title=\"x/o:achtens\">b</span></span></span></span><span title=\"f/m:neun\"><span title=\"f/y:nine\"><span title=\"it/is:9\"><span title=\"x/o:neuntens\">a</span></span></span></span></mark></span><span class=\"context-right\"><span class=\"more\"></span></span>",
res.at("/snippet").asText());
assertEquals("match-c1!d4-p3-9", res.at("/matchID").asText());
assertTrue(res.at("/pubDate").isMissingNode());
@@ -638,7 +655,7 @@
+ "<span class=\"more\">"
+ "</span>"
+ "</span>"
- + "<mark>"
+ + "<span class=\"match\"><mark>"
+
// "<span title=\"@:x/s:key:value\">"+
"<span title=\"f/m:acht\">"
@@ -654,6 +671,7 @@
+ "<span title=\"f/y:ten\">" + "<span title=\"it/is:10\">"
+ "<span title=\"x/o:zehntens\">c</span>" + "</span>"
+ "</span>" + "</span>" + "</mark>"
+ + "</span>"
+ "<span class=\"context-right\">" + "</span>",
res.at("/snippet").asText());
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
index 5aacbb5..a8b5491 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
@@ -63,11 +63,11 @@
assertEquals("totalResults", kr.getTotalResults(), 2);
assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 3, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "a[{3:{1:b}{2:c}}]abcaba ...", kr
+ assertEquals("SnippetBrackets (0)", "a[[{3:{1:b}{2:c}}]]abcaba ...", kr
.getMatch(0).getSnippetBrackets());
assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 6, kr.getMatch(1).endPos);
- assertEquals("SnippetBrackets (1)", "abca[{3:{1:b}{2:c}}]abac", kr
+ assertEquals("SnippetBrackets (1)", "abca[[{3:{1:b}{2:c}}]]abac", kr
.getMatch(1).getSnippetBrackets());
assertEquals("Document count", 1, ki.numberOf("base", "documents"));
@@ -86,7 +86,8 @@
+ "[(1-2)s:b|i:b|_1$<i>1<i>2]" + "[(2-3)s:c|i:c|_2$<i>2<i>3]"
+ "[(3-4)s:a|i:a|_3$<i>3<i>4]" + "[(4-5)s:b|i:b|_4$<i>4<i>5]"
+ "[(5-6)s:c|i:c|_5$<i>5<i>6]" + "[(6-7)s:a|i:a|_6$<i>6<i>7]"
- + "[(7-8)s:b|i:b|_7$<i>7<i>8]" + "[(8-9)s:a|i:a|_8$<i>8<i>9]"
+ + "[(7-8)s:b|i:b|_7$<i>7<i>8]" +
+ "[(8-9)s:a|i:a|_8$<i>8<i>9]"
+ "[(9-10)s:c|i:c|_9$<i>9<i>10]");
ki.addDoc(fd);
@@ -102,14 +103,17 @@
assertEquals("totalResults", kr.getTotalResults(), 1);
assertEquals("StartPos (0)", 7, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 9, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "... bcabca[b{1:a}]c",
+
+ assertEquals("SnippetBrackets (0)", "... bcabca[[b{1:a}]]c",
kr.getMatch(0).getSnippetBrackets());
- assertEquals(
+ assertEquals(
"Test no 'more' context",
- "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><mark>b<mark class=\"class-1 level-0\">a</mark></mark><span class=\"context-right\">c</span>",
+ "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><span class=\"match\"><mark>b<mark class=\"class-1 level-0\">a</mark></mark></span><span class=\"context-right\">c</span>",
kr.getMatch(0).getSnippetHTML());
- sq = new SpanFocusQuery(new SpanNextQuery(new SpanTermQuery(new Term(
+
+
+ sq = new SpanFocusQuery(new SpanNextQuery(new SpanTermQuery(new Term(
"base", "s:b")), new SpanClassQuery(new SpanTermQuery(new Term(
"base", "s:a")))));
kr = ki.search(sq, (short) 10);
@@ -117,7 +121,7 @@
assertEquals("totalResults", kr.getTotalResults(), 1);
assertEquals("StartPos (0)", 8, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 9, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "... cabcab[{1:a}]c", kr
+ assertEquals("SnippetBrackets (0)", "... cabcab[[{1:a}]]c", kr
.getMatch(0).getSnippetBrackets());
sq = new SpanFocusQuery(new SpanNextQuery(new SpanClassQuery(
new SpanTermQuery(new Term("base", "s:a")), (byte) 2),
@@ -129,26 +133,26 @@
assertEquals("totalResults", kr.getTotalResults(), 3);
assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 2, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "a[{3:b}]cabcab ...", kr
+ assertEquals("SnippetBrackets (0)", "a[[{3:b}]]cabcab ...", kr
.getMatch(0).getSnippetBrackets());
assertEquals(
- "<span class=\"context-left\">a</span><mark><mark class=\"class-3 level-0\">b</mark></mark><span class=\"context-right\">cabcab<span class=\"more\"></span></span>",
+ "<span class=\"context-left\">a</span><span class=\"match\"><mark><mark class=\"class-3 level-0\">b</mark></mark></span><span class=\"context-right\">cabcab<span class=\"more\"></span></span>",
kr.getMatch(0).getSnippetHTML());
assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 5, kr.getMatch(1).endPos);
- assertEquals("SnippetBrackets (1)", "abca[{3:b}]cabac", kr.getMatch(1)
+ assertEquals("SnippetBrackets (1)", "abca[[{3:b}]]cabac", kr.getMatch(1)
.getSnippetBrackets());
assertEquals(
- "<span class=\"context-left\">abca</span><mark><mark class=\"class-3 level-0\">b</mark></mark><span class=\"context-right\">cabac</span>",
+ "<span class=\"context-left\">abca</span><span class=\"match\"><mark><mark class=\"class-3 level-0\">b</mark></mark></span><span class=\"context-right\">cabac</span>",
kr.getMatch(1).getSnippetHTML());
assertEquals("StartPos (2)", 7, kr.getMatch(2).startPos);
assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
- assertEquals("SnippetBrackets (2)", "... bcabca[{3:b}]ac",
+ assertEquals("SnippetBrackets (2)", "... bcabca[[{3:b}]]ac",
kr.getMatch(2).getSnippetBrackets());
@@ -164,18 +168,18 @@
kr = ki.search(sq, (short) 10);
assertEquals("totalResults", kr.getTotalResults(), 1);
- assertEquals("SnippetBrackets (0)", "... bcabca[{2:b{1:a}}]c", kr
+ assertEquals("SnippetBrackets (0)", "... bcabca[[{2:b{1:a}}]]c", kr
.getMatch(0).getSnippetBrackets());
assertEquals(
"SnippetHTML (0) 1",
- "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><mark><mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\">c</span>",
+ "<span class=\"context-left\"><span class=\"more\"></span>bcabca</span><span class=\"match\"><mark><mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\">c</span>",
kr.getMatch(0).getSnippetHTML());
// Offset tokens
kr = ki.search(sq, 0, (short) 10, true, (short) 2, true, (short) 2);
assertEquals("totalResults", kr.getTotalResults(), 1);
- assertEquals("SnippetBrackets (0)", "... ca[{2:b{1:a}}]c",
+ assertEquals("SnippetBrackets (0)", "... ca[[{2:b{1:a}}]]c",
kr.getMatch(0).getSnippetBrackets());
@@ -183,12 +187,12 @@
// Offset Characters
kr = ki.search(sq, 0, (short) 10, false, (short) 1, false, (short) 0);
assertEquals("totalResults", kr.getTotalResults(), 1);
- assertEquals("SnippetBrackets (0)", "... a[{2:b{1:a}}] ...", kr
+ assertEquals("SnippetBrackets (0)", "... a[[{2:b{1:a}}]] ...", kr
.getMatch(0).getSnippetBrackets());
assertEquals(
"SnippetHTML (0) 2",
- "<span class=\"context-left\"><span class=\"more\"></span>a</span><mark><mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark><span class=\"context-right\"><span class=\"more\"></span></span>",
+ "<span class=\"context-left\"><span class=\"more\"></span>a</span><span class=\"match\"><mark><mark class=\"class-2 level-0\">b<mark class=\"class-1 level-1\">a</mark></mark></mark></span><span class=\"context-right\"><span class=\"more\"></span></span>",
kr.getMatch(0).getSnippetHTML());
@@ -213,11 +217,11 @@
assertEquals("totalResults", kr.getTotalResults(), 2);
assertEquals("StartPos (0)", 1, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 3, kr.getMatch(0).endPos);
- assertEquals("SnippetBrackets (0)", "a[{1:bc}]abcaba ...",
+ assertEquals("SnippetBrackets (0)", "a[[{1:bc}]]abcaba ...",
kr.getMatch(0).getSnippetBrackets());
assertEquals("StartPos (1)", 4, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 6, kr.getMatch(1).endPos);
- assertEquals("SnippetBrackets (1)", "abca[{1:bc}]abac", kr.getMatch(1)
+ assertEquals("SnippetBrackets (1)", "abca[[{1:bc}]]abac", kr.getMatch(1)
.getSnippetBrackets());
assertEquals(1, ki.numberOf("base", "documents"));
@@ -251,47 +255,47 @@
assertEquals("totalResults", kr.getTotalResults(), 7);
assertEquals(
"SnippetBrackets (0)",
- "<span class=\"context-left\"></span><mark>a</mark><span class=\"context-right\">bcabca<span class=\"more\"></span></span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark>a</mark></span><span class=\"context-right\">bcabca<span class=\"more\"></span></span>",
kr.getMatch(0).getSnippetHTML());
- assertEquals("SnippetBrackets (0)", "[a]bcabca ...", kr.getMatch(0)
+ assertEquals("SnippetBrackets (0)", "[[a]]bcabca ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("SnippetBrackets (1)", "ab[c]abcaba ...", kr.getMatch(1)
+ assertEquals("SnippetBrackets (1)", "ab[[c]]abcaba ...", kr.getMatch(1)
.getSnippetBrackets());
assertEquals(
"SnippetBrackets (1)",
- "<span class=\"context-left\">ab</span><mark>c</mark><span class=\"context-right\">abcaba<span class=\"more\"></span></span>",
+ "<span class=\"context-left\">ab</span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\">abcaba<span class=\"more\"></span></span>",
kr.getMatch(1).getSnippetHTML());
- assertEquals("SnippetBrackets (6)", "... abcaba[c]", kr.getMatch(6)
+ assertEquals("SnippetBrackets (6)", "... abcaba[[c]]", kr.getMatch(6)
.getSnippetBrackets());
assertEquals(
"SnippetBrackets (6)",
- "<span class=\"context-left\"><span class=\"more\"></span>abcaba</span><mark>c</mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\"><span class=\"more\"></span>abcaba</span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\"></span>",
kr.getMatch(6).getSnippetHTML());
kr = ki.search(sq, 0, (short) 20, true, (short) 0, true, (short) 0);
assertEquals("totalResults", kr.getTotalResults(), 7);
- assertEquals("SnippetBrackets (0)", "[a] ...", kr.getMatch(0)
+ assertEquals("SnippetBrackets (0)", "[[a]] ...", kr.getMatch(0)
.getSnippetBrackets());
assertEquals(
"SnippetHTML (0)",
- "<span class=\"context-left\"></span><mark>a</mark><span class=\"context-right\"><span class=\"more\"></span></span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark>a</mark></span><span class=\"context-right\"><span class=\"more\"></span></span>",
kr.getMatch(0).getSnippetHTML());
- assertEquals("SnippetBrackets (1)", "... [c] ...", kr.getMatch(1)
+ assertEquals("SnippetBrackets (1)", "... [[c]] ...", kr.getMatch(1)
.getSnippetBrackets());
assertEquals(
"SnippetHTML (1)",
- "<span class=\"context-left\"><span class=\"more\"></span></span><mark>c</mark><span class=\"context-right\"><span class=\"more\"></span></span>",
+ "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\"><span class=\"more\"></span></span>",
kr.getMatch(1).getSnippetHTML());
- assertEquals("SnippetBrackets (6)", "... [c]", kr.getMatch(6)
+ assertEquals("SnippetBrackets (6)", "... [[c]]", kr.getMatch(6)
.getSnippetBrackets());
assertEquals(
"SnippetBrackets (6)",
- "<span class=\"context-left\"><span class=\"more\"></span></span><mark>c</mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\"></span>",
kr.getMatch(6).getSnippetHTML());
};
@@ -323,7 +327,7 @@
kr = ki.search(sq, 0, (short) 20, true, (short) 2, true, (short) 5);
assertEquals("totalResults", kr.getTotalResults(), 1);
- assertEquals("SnippetBrackets (0)", "... ca[{1:ba{2:c}}]",
+ assertEquals("SnippetBrackets (0)", "... ca[[{1:ba{2:c}}]]",
kr.getMatch(0).getSnippetBrackets());
};
@@ -358,7 +362,7 @@
Match km = kr.getMatch(0);
assertEquals("StartPos (0)", 1, km.startPos);
assertEquals("EndPos (0)", 2, km.endPos);
- assertEquals("SnippetBrackets (0)", "a[{3:b}]cabcab ...",
+ assertEquals("SnippetBrackets (0)", "a[[{3:b}]]cabcab ...",
km.getSnippetBrackets());
sq = new SpanFocusQuery(new SpanFocusQuery(new SpanNextQuery(
@@ -372,7 +376,7 @@
km = kr.getMatch(0);
assertEquals("StartPos (0)", 0, km.startPos);
assertEquals("EndPos (0)", 1, km.endPos);
- assertEquals("SnippetBrackets (0)", "[{2:a}]bcabca ...",
+ assertEquals("SnippetBrackets (0)", "[[{2:a}]]bcabca ...",
km.getSnippetBrackets());
// TODO: Check ID
@@ -417,7 +421,7 @@
assertEquals(kr.getSerialQuery(),
"focus(3: spanContain({2: <base:s />}, {3: base:s:b}))");
- assertEquals(kr.getMatch(0).getSnippetBrackets(), "a[{3:b}]cabcab ...");
+ assertEquals(kr.getMatch(0).getSnippetBrackets(), "a[[{3:b}]]cabcab ...");
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
index 0465585..561d6bb 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
@@ -120,7 +120,7 @@
new SpanElementQuery("base", "x"));
kr = ki.search(sq, (short) 10);
- assertEquals("ab[cabca]bac", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("ab[[cabca]]bac", kr.getMatch(1).getSnippetBrackets());
};
@@ -148,7 +148,7 @@
new SpanTermQuery(new Term("base", "s:b")));
kr = ki.search(sq, (short) 10);
- assertEquals("abc[abcab]ac", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("abc[[abcab]]ac", kr.getMatch(0).getSnippetBrackets());
};
@@ -189,22 +189,22 @@
kr = ki.search(sq, (short) 10);
assertEquals("TotalResults", kr.getTotalResults(), 2);
- assertEquals("abc[abcab]ac", kr.getMatch(0).getSnippetBrackets());
- assertEquals("xbz[xbzxb]xz", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("abc[[abcab]]ac", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("xbz[[xbzxb]]xz", kr.getMatch(1).getSnippetBrackets());
sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:c")),
new SpanElementQuery("base", "x"));
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 1);
- assertEquals("ab[cabca]bac", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("ab[[cabca]]bac", kr.getMatch(0).getSnippetBrackets());
sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:z")),
new SpanElementQuery("base", "x"));
kr = ki.search(sq, (short) 10);
assertEquals(1, kr.getTotalResults());
- assertEquals("xb[zxbzx]bxz", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("xb[[zxbzx]]bxz", kr.getMatch(0).getSnippetBrackets());
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java
index 62f239a..1cc71a5 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRegexWildcardIndex.java
@@ -47,42 +47,42 @@
Result kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("[affe] afffe ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("affe [afffe] baum ...", kr.getMatch(1)
+ assertEquals("[[affe]] afffe ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("affe [[afffe]] baum ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:baum.*"));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... afffe [baum] baumgarten ...", kr.getMatch(0)
+ assertEquals("... afffe [[baum]] baumgarten ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... baum [baumgarten] steingarten ...", kr.getMatch(1)
+ assertEquals("... baum [[baumgarten]] steingarten ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:.....?garten"));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... baum [baumgarten] steingarten ...", kr.getMatch(0)
+ assertEquals("... baum [[baumgarten]] steingarten ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... baumgarten [steingarten] franz ...", kr.getMatch(1)
+ assertEquals("... baumgarten [[steingarten]] franz ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:ha.s"));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... franz [hans] haus ...", kr.getMatch(0)
+ assertEquals("... franz [[hans]] haus ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... hans [haus] efeu ...", kr.getMatch(1)
+ assertEquals("... hans [[haus]] efeu ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:.*ff.*"));
kr = ki.search(ks);
assertEquals((long) 3, kr.getTotalResults());
- assertEquals("[affe] afffe ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("affe [afffe] baum ...", kr.getMatch(1)
+ assertEquals("[[affe]] afffe ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("affe [[afffe]] baum ...", kr.getMatch(1)
.getSnippetBrackets());
- assertEquals("... efeu [effe]", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("... efeu [[effe]]", kr.getMatch(2).getSnippetBrackets());
};
@Test
@@ -116,8 +116,8 @@
Result kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("[affe] afffe ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("affe [afffe] baum ...", kr.getMatch(1)
+ assertEquals("[[affe]] afffe ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("affe [[afffe]] baum ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").wc("s:baum.*"));
@@ -128,32 +128,32 @@
ks = _newKrill(new QueryBuilder("base").wc("s:baum*"));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... afffe [baum] baumgarten ...", kr.getMatch(0)
+ assertEquals("... afffe [[baum]] baumgarten ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... baum [baumgarten] steingarten ...", kr.getMatch(1)
+ assertEquals("... baum [[baumgarten]] steingarten ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").wc("s:*garten"));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... baum [baumgarten] steingarten ...", kr.getMatch(0)
+ assertEquals("... baum [[baumgarten]] steingarten ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... baumgarten [steingarten] franz ...", kr.getMatch(1)
+ assertEquals("... baumgarten [[steingarten]] franz ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").wc("s:ha?s"));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... franz [hans] haus ...", kr.getMatch(0)
+ assertEquals("... franz [[hans]] haus ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... hans [haus] efeu ...", kr.getMatch(1)
+ assertEquals("... hans [[haus]] efeu ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").wc("s:?ff?"));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("[affe] afffe ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("... efeu [effe]", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("[[affe]] afffe ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("... efeu [[effe]]", kr.getMatch(1).getSnippetBrackets());
};
@@ -187,56 +187,56 @@
Krill ks = _newKrill(sqw);
Result kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("[AfFe] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("AfFe [aFfFE] Baum ...", kr.getMatch(1)
+ assertEquals("[[AfFe]] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("AfFe [[aFfFE]] Baum ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:Af.*e"));
kr = ki.search(ks);
assertEquals((long) 1, kr.getTotalResults());
- assertEquals("[AfFe] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("[[AfFe]] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:baum.*",
true));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... aFfFE [Baum] Baumgarten ...", kr.getMatch(0)
+ assertEquals("... aFfFE [[Baum]] Baumgarten ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... Baum [Baumgarten] SteinGarten ...", kr.getMatch(1)
+ assertEquals("... Baum [[Baumgarten]] SteinGarten ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re(
"s:.*garten", true));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... Baum [Baumgarten] SteinGarten ...", kr.getMatch(0)
+ assertEquals("... Baum [[Baumgarten]] SteinGarten ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... Baumgarten [SteinGarten] franZ ...", kr.getMatch(1)
+ assertEquals("... Baumgarten [[SteinGarten]] franZ ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:.*garten", false));
kr = ki.search(ks);
assertEquals((long) 1, kr.getTotalResults());
- assertEquals("... Baum [Baumgarten] SteinGarten ...", kr.getMatch(0)
+ assertEquals("... Baum [[Baumgarten]] SteinGarten ...", kr.getMatch(0)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:ha.s",
true));
kr = ki.search(ks);
assertEquals((long) 2, kr.getTotalResults());
- assertEquals("... franZ [HaNs] Haus ...", kr.getMatch(0)
+ assertEquals("... franZ [[HaNs]] Haus ...", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("... HaNs [Haus] Efeu ...", kr.getMatch(1)
+ assertEquals("... HaNs [[Haus]] Efeu ...", kr.getMatch(1)
.getSnippetBrackets());
ks = _newKrill(new QueryBuilder("base").re("s:.*f*e",
true));
kr = ki.search(ks);
assertEquals((long) 3, kr.getTotalResults());
- assertEquals("[AfFe] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("AfFe [aFfFE] Baum ...", kr.getMatch(1)
+ assertEquals("[[AfFe]] aFfFE ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("AfFe [[aFfFE]] Baum ...", kr.getMatch(1)
.getSnippetBrackets());
- assertEquals("... Efeu [effe]", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("... Efeu [[effe]]", kr.getMatch(2).getSnippetBrackets());
};
@@ -276,7 +276,7 @@
Result kr = ki.search(ks);
assertEquals((long) 1, kr.getTotalResults());
- assertEquals("[affe afffe] baum ...", kr.getMatch(0)
+ assertEquals("[[affe afffe]] baum ...", kr.getMatch(0)
.getSnippetBrackets());
};
@@ -316,7 +316,7 @@
Result kr = ki.search(ks);
assertEquals((long) 1, kr.getTotalResults());
- assertEquals("[affe afffe] baum ...", kr.getMatch(0)
+ assertEquals("[[affe afffe]] baum ...", kr.getMatch(0)
.getSnippetBrackets());
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
index 2a81f68..08f56a8 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
@@ -387,8 +387,8 @@
// );
// };
- assertEquals("[cecc]ecdeec", kr.getMatch(0).getSnippetBrackets());
- assertEquals("cec[cecd]eec", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("[[cecc]]ecdeec", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("cec[[cecd]]eec", kr.getMatch(1).getSnippetBrackets());
assertEquals((long) 2, kr.getTotalResults());
}
@@ -415,19 +415,19 @@
"focus(254: spanContain(<base:base/s:t />, {254: spanExpansion(base:s:c, []{0, 4}, right)}))");
kr = ki.search(sq, (short) 10);
- assertEquals("[c]ab", kr.getMatch(0).getSnippetBrackets());
- assertEquals("[ca]b", kr.getMatch(1).getSnippetBrackets());
- assertEquals("[cab]", kr.getMatch(2).getSnippetBrackets());
- assertEquals("[c]e", kr.getMatch(3).getSnippetBrackets());
+ assertEquals("[[c]]ab", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("[[ca]]b", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("[[cab]]", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("[[c]]e", kr.getMatch(3).getSnippetBrackets());
- assertEquals("[ce]", kr.getMatch(4).getSnippetBrackets());
+ assertEquals("[[ce]]", kr.getMatch(4).getSnippetBrackets());
assertEquals(5, kr.getTotalResults());
sq = kq.builder().tag("base/s:t").toQuery();
assertEquals(sq.toString(), "<base:base/s:t />");
kr = ki.search(sq, (short) 5);
- assertEquals("[cab]", kr.getMatch(0).getSnippetBrackets());
- assertEquals("[ce]", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("[[cab]]", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("[[ce]]", kr.getMatch(1).getSnippetBrackets());
assertEquals(2, kr.getTotalResults());
}
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
index c415ca1..206628b 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
@@ -155,10 +155,10 @@
assertEquals(2, kr.getTotalResults());
assertEquals(1, kr.getMatch(0).getStartPos());
assertEquals(2, kr.getMatch(0).getEndPos());
- assertEquals("a [b ]c ", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("a [[b ]]c ", kr.getMatch(0).getSnippetBrackets());
assertEquals(2, kr.getMatch(1).getStartPos());
assertEquals(3, kr.getMatch(1).getEndPos());
- assertEquals("a b [c ]", kr.getMatch(1).getSnippetBrackets());
+ assertEquals("a b [[c ]]", kr.getMatch(1).getSnippetBrackets());
};
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
index b0bd6cc..cff70ca 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
@@ -435,28 +435,28 @@
assertEquals("StartPos (0)", 0, kr.getMatch(0).startPos);
assertEquals("EndPos (0)", 4, kr.getMatch(0).endPos);
- assertEquals("Snippet (0)", "[h h i j ]h i j h i j ...", kr
+ assertEquals("Snippet (0)", "[[h h i j ]]h i j h i j ...", kr
.getMatch(0).getSnippetBrackets());
assertEquals("StartPos (1)", 0, kr.getMatch(1).startPos);
assertEquals("EndPos (1)", 4, kr.getMatch(1).endPos);
- assertEquals("Snippet (1)", "[h h i j ]h i j h i j ...", kr
+ assertEquals("Snippet (1)", "[[h h i j ]]h i j h i j ...", kr
.getMatch(1).getSnippetBrackets());
assertEquals("StartPos (2)", 0, kr.getMatch(2).startPos);
assertEquals("EndPos (2)", 8, kr.getMatch(2).endPos);
- assertEquals("Snippet (2)", "[h h i j h i j h ]i j ",
+ assertEquals("Snippet (2)", "[[h h i j h i j h ]]i j ",
kr.getMatch(2).getSnippetBrackets());
assertEquals("StartPos (3)", 0, kr.getMatch(3).startPos);
assertEquals("EndPos (3)", 8, kr.getMatch(3).endPos);
- assertEquals("Snippet (3)", "[h h i j h i j h ]i j ",
+ assertEquals("Snippet (3)", "[[h h i j h i j h ]]i j ",
kr.getMatch(3).getSnippetBrackets());
assertEquals("StartPos (4)", 0, kr.getMatch(4).startPos);
assertEquals("EndPos (4)", 8, kr.getMatch(4).endPos);
- assertEquals("Snippet (4)", "[h h i j h i j h ]i j ",
+ assertEquals("Snippet (4)", "[[h h i j h i j h ]]i j ",
kr.getMatch(4).getSnippetBrackets());
assertEquals("StartPos (5)", 0, kr.getMatch(5).startPos);
assertEquals("EndPos (5)", 8, kr.getMatch(5).endPos);
- assertEquals("Snippet (5)", "[h h i j h i j h ]i j ",
+ assertEquals("Snippet (5)", "[[h h i j h i j h ]]i j ",
kr.getMatch(5).getSnippetBrackets());
@@ -832,24 +832,24 @@
kr = ki.search(sq, 0, (short) 15, true, (short) 1, true, (short) 1);
assertEquals("totalResults", kr.getTotalResults(), 1);
- assertEquals("... schrie: [\"{3:Das war ich}!\"] und ...",
+ assertEquals("... schrie: [[\"{3:Das war ich}!\"]] und ...",
kr.getMatch(0).getSnippetBrackets());
assertEquals(
- "<span class=\"context-left\"><span class=\"more\"></span>schrie: </span><mark>"<mark class=\"class-3 level-0\">Das war ich</mark>!"</mark><span class=\"context-right\"> und<span class=\"more\"></span></span>",
+ "<span class=\"context-left\"><span class=\"more\"></span>schrie: </span><span class=\"match\"><mark>"<mark class=\"class-3 level-0\">Das war ich</mark>!"</mark></span><span class=\"context-right\"> und<span class=\"more\"></span></span>",
kr.getMatch(0).getSnippetHTML());
kr = ki.search(sq, 0, (short) 15, true, (short) 0, true, (short) 0);
- assertEquals("... [\"{3:Das war ich}!\"] ...", kr.getMatch(0)
+ assertEquals("... [[\"{3:Das war ich}!\"]] ...", kr.getMatch(0)
.getSnippetBrackets());
assertEquals("totalResults", kr.getTotalResults(), 1);
kr = ki.search(sq, 0, (short) 15, true, (short) 6, true, (short) 6);
- assertEquals("Er schrie: [\"{3:Das war ich}!\"] und ging.", kr
+ assertEquals("Er schrie: [[\"{3:Das war ich}!\"]] und ging.", kr
.getMatch(0).getSnippetBrackets());
assertEquals("totalResults", kr.getTotalResults(), 1);
kr = ki.search(sq, 0, (short) 15, true, (short) 2, true, (short) 2);
- assertEquals("Er schrie: [\"{3:Das war ich}!\"] und ging ...", kr
+ assertEquals("Er schrie: [[\"{3:Das war ich}!\"]] und ging ...", kr
.getMatch(0).getSnippetBrackets());
assertEquals("totalResults", kr.getTotalResults(), 1);
@@ -858,7 +858,7 @@
new Term("base", "s:Das")), (byte) 2)), (byte) 1);
kr = ki.search(sq, (short) 15);
- assertEquals("Er schrie: [\"{1:{2:Das} war ich}!\"] und ging.", kr
+ assertEquals("Er schrie: [[\"{1:{2:Das} war ich}!\"]] und ging.", kr
.getMatch(0).getSnippetBrackets());
assertEquals("totalResults", kr.getTotalResults(), 1);
@@ -867,7 +867,7 @@
new Term("base", "s:war")), (byte) 2)), (byte) 1);
kr = ki.search(sq, (short) 15);
- assertEquals("Er schrie: [\"{1:Das {2:war} ich}!\"] und ging.", kr
+ assertEquals("Er schrie: [[\"{1:Das {2:war} ich}!\"]] und ging.", kr
.getMatch(0).getSnippetBrackets());
assertEquals("totalResults", kr.getTotalResults(), 1);
@@ -876,7 +876,7 @@
new Term("base", "s:ich")), (byte) 2)), (byte) 1);
kr = ki.search(sq, (short) 15);
- assertEquals("Er schrie: [\"{1:Das war {2:ich}}!\"] und ging.", kr
+ assertEquals("Er schrie: [[\"{1:Das war {2:ich}}!\"]] und ging.", kr
.getMatch(0).getSnippetBrackets());
assertEquals("totalResults", kr.getTotalResults(), 1);
@@ -924,9 +924,9 @@
assertEquals("totalResults", kr.getTotalResults(), 2);
- assertEquals("x y [x ]b c x ", kr.getMatch(0)
+ assertEquals("x y [[x ]]b c x ", kr.getMatch(0)
.getSnippetBrackets());
- assertEquals("x y [x b c ]x ", kr.getMatch(1)
+ assertEquals("x y [[x b c ]]x ", kr.getMatch(1)
.getSnippetBrackets());
assertEquals("StartPos (0)", 2, kr.getMatch(0).startPos);
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
index e9dee2d..4c465b3 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
@@ -104,7 +104,7 @@
Result kr = ks.apply(ki);
assertEquals(kr.getTotalResults(), 6);
assertEquals(kr.getMatch(0).getSnippetBrackets(),
- "... dem [Buchstaben] A ...");
+ "... dem [[Buchstaben]] A ...");
JsonNode res = ks.toJsonNode();
assertEquals(3, res.at("/meta/count").asInt());
@@ -137,7 +137,7 @@
assertEquals(kr.getTotalResults(), 66);
assertEquals(5, kr.getItemsPerPage());
assertEquals(5, kr.getStartIndex());
- assertEquals("... a: A ist [der klangreichste] der V ...",
+ assertEquals("... a: A ist [[der klangreichste]] der V ...",
kr.getMatch(0).getSnippetBrackets());
};
@@ -318,7 +318,7 @@
Result kr = ks.apply(ki);
assertEquals(kr.getTotalResults(), 10);
assertEquals("A bzw. a ist der erste Buchstabe des"
- + " lateinischen [Alphabets] und ein Vokal."
+ + " lateinischen [[Alphabets]] und ein Vokal."
+ " Der Buchstabe A hat in deutschen Texten"
+ " eine durchschnittliche Häufigkeit ...", kr.getMatch(0)
.getSnippetBrackets());
@@ -341,7 +341,7 @@
+ " das Nukleosid Adenosin steht A die Base"
+ " Adenin steht A für die Aminosäure Alanin"
+ " in der Informatik steht a für den dezimalen"
- + " [Wert] 97 sowohl im ASCII- als auch im"
+ + " [[Wert]] 97 sowohl im ASCII- als auch im"
+ " Unicode-Zeichensatz steht A für den dezimalen"
+ " Wert 65 sowohl im ASCII- als auch im"
+ " Unicode-Zeichensatz als Kfz-Kennzeichen"
@@ -681,7 +681,7 @@
assertEquals(
kr.getMatch(0).getSnippetBrackets(),
"... Initiative\" eine neue politische Gruppierung ins "
- + "[{1:Leben}] gerufen hatten. Pressemeldungen zufolge haben sich ...");
+ + "[[{1:Leben}]] gerufen hatten. Pressemeldungen zufolge haben sich ...");
// Try with high class - don't highlight
ks = new Krill(kq.focus(129,
@@ -693,7 +693,7 @@
assertEquals(
kr.getMatch(0).getSnippetBrackets(),
"... Initiative\" eine neue politische Gruppierung ins "
- + "[Leben] gerufen hatten. Pressemeldungen zufolge haben sich ...");
+ + "[[Leben]] gerufen hatten. Pressemeldungen zufolge haben sich ...");
ks = new Krill(json);
kr = ks.apply(ki);
@@ -703,9 +703,9 @@
+ "{129: tokens:s:Leben}, [(base/s:s[0:1], notOrdered, notExcluded)]))");
assertEquals(
kr.getMatch(0).getSnippetBrackets(),
- "... ihren Austritt erklärt und unter dem [Namen \"Einheitsbewegung "
+ "... ihren Austritt erklärt und unter dem [[Namen \"Einheitsbewegung "
+ "der sozialistischen Initiative\" eine neue politische Gruppierung "
- + "ins Leben] gerufen hatten. Pressemeldungen zufolge haben sich ...");
+ + "ins Leben]] gerufen hatten. Pressemeldungen zufolge haben sich ...");
assertEquals(kr.getTotalResults(), 1);
assertEquals(0, kr.getStartIndex());
};
@@ -734,7 +734,7 @@
assertEquals(
kr.getMatch(0).getSnippetBrackets(),
"... sozialistischen Initiative\" eine neue politische"
- + " Gruppierung [{4:{1:{2:ins} {3:Leben}} gerufen}] hatten. "
+ + " Gruppierung [[{4:{1:{2:ins} {3:Leben}} gerufen}]] hatten. "
+ "Pressemeldungen zufolge haben sich in ...");
assertEquals(kr.getTotalResults(), 2);
assertEquals(0, kr.getStartIndex());
@@ -830,19 +830,19 @@
assertEquals(0, kr.getStartIndex());
assertEquals(kr.getMatch(0).getSnippetBrackets(),
- "[Saragat-Partei] zerfällt Rom (ADN) die von dem ...");
+ "[[Saragat-Partei]] zerfällt Rom (ADN) die von dem ...");
assertEquals(kr.getMatch(1).getSnippetBrackets(),
- "[Saragat-Partei] zerfällt Rom (ADN) die von dem ...");
+ "[[Saragat-Partei]] zerfällt Rom (ADN) die von dem ...");
assertEquals(kr.getMatch(2).getSnippetBrackets(),
- "Saragat-Partei zerfällt [Rom] (ADN) "
+ "Saragat-Partei zerfällt [[Rom]] (ADN) "
+ "die von dem Rechtssozialisten Saragat ...");
assertEquals(kr.getMatch(3).getSnippetBrackets(),
- "Saragat-Partei zerfällt Rom ([ADN]) "
+ "Saragat-Partei zerfällt Rom ([[ADN]]) "
+ "die von dem Rechtssozialisten Saragat geführte ...");
assertEquals(
kr.getMatch(23).getSnippetBrackets(),
"... dem Namen \"Einheitsbewegung der sozialistischen "
- + "Initiative\" [eine neue politische Gruppierung] "
+ + "Initiative\" [[eine neue politische Gruppierung]] "
+ "ins Leben gerufen hatten. Pressemeldungen zufolge ...");
};
@@ -970,7 +970,7 @@
Result kr = ks.apply(ki);
assertEquals(kr.getMatch(1).getSnippetBrackets(),
- "... dezimalen [Wert] 65 sowohl ...");
+ "... dezimalen [[Wert]] 65 sowohl ...");
assertEquals(kr.getTotalResults(), 3);
assertEquals(0, kr.getStartIndex());
assertEquals(25, kr.getItemsPerPage());
@@ -985,15 +985,15 @@
assertEquals(kr.getContext().toJsonNode().toString(), "\"base/s:s\"");
assertEquals(kr.getMatch(0).getSnippetBrackets(),
- "steht a für den dezimalen [Wert] 97 sowohl im ASCII-"
+ "steht a für den dezimalen [[Wert]] 97 sowohl im ASCII-"
+ " als auch im Unicode-Zeichensatz");
assertEquals(kr.getMatch(1).getSnippetBrackets(),
- "steht A für den dezimalen [Wert] 65 sowohl im ASCII-"
+ "steht A für den dezimalen [[Wert]] 65 sowohl im ASCII-"
+ " als auch im Unicode-Zeichensatz");
assertEquals(kr.getMatch(2).getSnippetBrackets(),
"In einem Zahlensystem mit einer Basis größer "
+ "als 10 steht A oder a häufig für den dezimalen"
- + " [Wert] 10, siehe auch Hexadezimalsystem.");
+ + " [[Wert]] 10, siehe auch Hexadezimalsystem.");
};
@@ -1038,7 +1038,7 @@
Result kr = new Krill(json).apply(ki);
assertEquals("... Buchstabe des Alphabetes. In Dänemark ist "
- + "[der alte Digraph Aa durch Å] ersetzt worden, "
+ + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
+ "in Eigennamen und Ortsnamen ...", kr.getMatch(0)
.getSnippetBrackets());
assertEquals("WPD_AAA.00002", kr.getMatch(0).getDocID());
@@ -1061,7 +1061,7 @@
// focus(254: spanContain(<tokens:base/s:t />, {254: spanNext(spanNext(spanNext(spanNext(tokens:s:der, tokens:s:alte), tokens:s:Digraph), tokens:s:Aa), spanExpansion(tokens:s:durch, []{1, 1}, right))}))
assertEquals("... Buchstabe des Alphabetes. In Dänemark ist "
- + "[der alte Digraph Aa durch Å] ersetzt worden, "
+ + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
+ "in Eigennamen und Ortsnamen ...", kr.getMatch(0)
.getSnippetBrackets());
assertEquals("WPD_AAA.00002", kr.getMatch(0).getDocID());
@@ -1084,7 +1084,7 @@
kr = new Krill(json).apply(ki);
assertEquals("... Buchstabe des Alphabetes. In Dänemark ist "
- + "[der alte Digraph Aa durch Å] ersetzt worden, "
+ + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
+ "in Eigennamen und Ortsnamen ...", kr.getMatch(0)
.getSnippetBrackets());
assertEquals("WPD_AAA.00002", kr.getMatch(0).getDocID());
@@ -1096,7 +1096,7 @@
kr = new Krill(json).apply(ki);
assertEquals("... Buchstabe des Alphabetes. In Dänemark ist "
- + "[der alte Digraph Aa durch Å] ersetzt worden, "
+ + "[[der alte Digraph Aa durch Å]] ersetzt worden, "
+ "in Eigennamen und Ortsnamen ...", kr.getMatch(0)
.getSnippetBrackets());
assertEquals("WPD_AAA.00002", kr.getMatch(0).getDocID());
@@ -1124,7 +1124,7 @@
Result kr = k.apply(ki);
assertEquals(kr.getTotalResults(), 1);
assertEquals(kr.getMatch(0).getSnippetBrackets(),
- "[Selbst ist der Jeck]");
+ "[[Selbst ist der Jeck]]");
assertEquals(kr.getMatch(0).getTextSigle(), "PRO-DUD_BSP-2013-01.32");
};
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestResult.java b/src/test/java/de/ids_mannheim/korap/search/TestResult.java
index 53a42f1..a106fae 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestResult.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestResult.java
@@ -78,7 +78,7 @@
assertEquals("match-doc-1-p0-1(1)0-0", res.at("/matches/0/matchID")
.asText());
assertEquals(
- "<span class=\"context-left\"></span><mark><mark class=\"class-1 level-0\">a</mark></mark><span class=\"context-right\">bab</span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark><mark class=\"class-1 level-0\">a</mark></mark></span><span class=\"context-right\">bab</span>",
res.at("/matches/0/snippet").asText());
assertEquals("base", res.at("/matches/6/field").asText());
@@ -92,7 +92,7 @@
assertEquals("match-doc-2-p2-3(1)2-2", res.at("/matches/6/matchID")
.asText());
assertEquals(
- "<span class=\"context-left\">ab</span><mark><mark class=\"class-1 level-0\">a</mark></mark><span class=\"context-right\"></span>",
+ "<span class=\"context-left\">ab</span><span class=\"match\"><mark><mark class=\"class-1 level-0\">a</mark></mark></span><span class=\"context-right\"></span>",
res.at("/matches/6/snippet").asText());
};
@@ -197,7 +197,7 @@
assertEquals("doc-1", res.at("/matches/0/docID").asText());
assertEquals("match-doc-1-p0-1", res.at("/matches/0/matchID").asText());
assertEquals(
- "<span class=\"context-left\"></span><mark>a</mark><span class=\"context-right\">bab</span>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark>a</mark></span><span class=\"context-right\">bab</span>",
res.at("/matches/0/snippet").asText());
// No primaryData serialization