Readded class ordering fix
Change-Id: I387754b9a293ea83dc99983c0c51a12d9e145a0a
diff --git a/Changes b/Changes
index ccd2c41..71704d4 100644
--- a/Changes
+++ b/Changes
@@ -22,6 +22,7 @@
(margaretha)
- [bugfix] issue #16 (added skipTo in ElementDistanceSpan)
(margaretha)
+ - [bugfix] Fixed class ordering of highlights (diewald)
0.55.6 2016-08-10
- [bugfix] distance with key "t" uses default foundry (diewald)
diff --git a/src/main/java/de/ids_mannheim/korap/KrillStats.java b/src/main/java/de/ids_mannheim/korap/KrillStats.java
index 24d3467..eacf921 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillStats.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillStats.java
@@ -49,6 +49,9 @@
*/
/*
* TODO: THIS IS CURRENTLY HIGHLY EXPERIMENTAL
+ * TODO: Stats may use Column Stride fields (or DocValues)
+ * (or similiar concepts) https://issues.apache.org/jira/browse/LUCENE-1231
+ * https://issues.apache.org/jira/browse/LUCENE-3108
*/
public final class KrillStats extends Notifications {
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 56e7dd9..978a6a6 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -880,7 +880,7 @@
// Compare class number
if (arg0[2] > arg1[2])
return 1;
- else if (arg0[2] < arg1[1])
+ else if (arg0[2] < arg1[2])
return -1;
return 0;
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 9bfbfae..572f1eb 100644
--- a/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
+++ b/src/test/java/de/ids_mannheim/korap/highlight/TestHighlight.java
@@ -137,9 +137,9 @@
km.getSnippetHTML());
km.addHighlight(0, 1, (short) 5);
- assertEquals("[[{7:{5:a{6:b}}}{6:c}]]", km.getSnippetBrackets());
+ assertEquals("[[{5:{7:a{6:b}}}{6:c}]]", km.getSnippetBrackets());
assertEquals(
- "<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>",
+ "<span class=\"context-left\"></span><span class=\"match\"><mark><mark class=\"class-5 level-0\"><mark class=\"class-7 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());
};
@@ -252,18 +252,18 @@
kr = ki.search(qs);
assertEquals((long) 10, kr.getTotalResults());
- assertEquals("[[{3:{1:a}}]] ...", kr.getMatch(0).getSnippetBrackets());
- assertEquals("... [[{3:{2:a}}]] ...",
+ assertEquals("[[{1:{3:a}}]] ...", kr.getMatch(0).getSnippetBrackets());
+ assertEquals("... [[{2:{3: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}}]] ...",
+ assertEquals("... [[{1:{3:b}}]]", kr.getMatch(2).getSnippetBrackets());
+ assertEquals("[[{1:{3:a}}]] ...", kr.getMatch(3).getSnippetBrackets());
+ assertEquals("... [[{2:{3:a}}]]", kr.getMatch(4).getSnippetBrackets());
+ assertEquals("[[{1:{3:a}}]] ...", kr.getMatch(5).getSnippetBrackets());
+ assertEquals("... [[{2:{3: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("... [[{1:{3:b}}]]", kr.getMatch(7).getSnippetBrackets());
+ assertEquals("[[{1:{3:a}}]] ...", kr.getMatch(8).getSnippetBrackets());
+ assertEquals("... [[{2:{3:a}}]]", kr.getMatch(9).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 e53ad87..c208a3e 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -362,40 +362,55 @@
"x", null, true, false);
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/o:erstens:{x/rel:a>3: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>" + "<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>",
+ assertEquals("SnippetHTML (1)", "<span class=\"context-left\">"
+ + "</span>" + "<span class=\"match\">"
+ + "<mark>"
+ + "<span title=\"x/o:erstens\">"
+ + "<span xlink:title=\"x/rel:a\" xlink:type=\"simple\" "
+ + "xlink:href=\"#word-c1!d1-p3\">"
+ + "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>" + "<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>"
- + "<mark class=\"class-7 level-0\">"
- + "<span title=\"x/o:drittens\">" + "c" + "</span>"
- + "<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>" + "<span class=\"context-right\">"
- + "<span class=\"more\">" + "</span>" + "</span>",
- km.getSnippetHTML());
+ assertEquals("SnippetHTML (2)",
+ "<span class=\"context-left\">"
+ + "</span>" + "<span class=\"match\">"+"<mark>"
+ +"<span title=\"x/o:erstens\">"
+ +"<span xlink:title=\"x/rel:a\" " + "xlink:type=\"simple\" "
+ +"xlink:href=\"#word-c1!d1-p3\">a</span>"
+ +"</span>"
+ +"<span title=\"x/o:zweitens\">b</span>"
+ +"<mark class=\"class-7 level-0\">"
+ +"<span title=\"x/o:drittens\">c</span>"
+ +"<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>"
+ +"<span class=\"context-right\">"
+ +"<span class=\"more\"></span>"
+ +"</span>",
+ km.getSnippetHTML());
};
@@ -469,30 +484,32 @@
ki.commit();
Match km = ki.getMatchInfo("match-c1!d1-p0-4", "tokens", null, null,
- true, true);
+ true, true);
assertEquals("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\">" + "<span title=\"f/y:one\">"
- + "<span title=\"it/is:1\">"
- + "<span title=\"x/o:erstens\">a</span>" + "</span>" + "</span>"
- + "</span>" + "</span>"
- + "<span xlink:title=\"x/rel:b\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"
- + "<span title=\"f/m:zwei\">" + "<span title=\"f/y:two\">"
- + "<span title=\"it/is:2\">"
- + "<span title=\"x/o:zweitens\">b</span>" + "</span>"
- + "</span>" + "</span>" + "</span>"
- + "<span title=\"f/m:drei\">" + "<span title=\"f/y:three\">"
- + "<span title=\"it/is:3\">"
- + "<span title=\"x/o:drittens\">c</span>" + "</span>"
- + "</span>" + "</span>" + "<span xml:id=\"word-c1!d1-p3\">"
- + "<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>" + "</mark>" + "</span>"
- + "<span class=\"context-right\">" + "<span class=\"more\">"
- + "</span>" + "</span>", km.getSnippetHTML());
+ + "</span>" + "<span class=\"match\">" + "<mark>"
+ + "<span title=\"f/m:eins\">" + "<span title=\"f/y:one\">"
+ + "<span title=\"it/is:1\">"
+ + "<span title=\"x/o:erstens\">"
+ + "<span xlink:title=\"x/rel:a\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"
+ + "a</span>" + "</span>" + "</span>"
+ + "</span>" + "</span>"
+ + "<span title=\"f/m:zwei\">" + "<span title=\"f/y:two\">"
+ + "<span title=\"it/is:2\">"
+ + "<span title=\"x/o:zweitens\">"
+ + "<span xlink:title=\"x/rel:b\" xlink:type=\"simple\" xlink:href=\"#word-c1!d1-p3\">"
+ + "b</span>" + "</span>"
+ + "</span>" + "</span>" + "</span>"
+ + "<span title=\"f/m:drei\">" + "<span title=\"f/y:three\">"
+ + "<span title=\"it/is:3\">"
+ + "<span title=\"x/o:drittens\">c</span>" + "</span>"
+ + "</span>" + "</span>" + "<span xml:id=\"word-c1!d1-p3\">"
+ + "<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>" + "</mark>" + "</span>"
+ + "<span class=\"context-right\">" + "<span class=\"more\">"
+ + "</span>" + "</span>", km.getSnippetHTML());
};