Skip to content

Commit

Permalink
Correctly calculate endpage
Browse files Browse the repository at this point in the history
Change-Id: I8d0c07da122c282fda5e9361b8b8c26d22a75d1c
  • Loading branch information
Akron committed Jun 26, 2024
1 parent a102c34 commit 37e2e8a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [bugfix] Prevent showing empty elements and opening tags past primary data
(diewald).
- [cleanup] Cleanup test generated directories after run (diewald)
- [bugfix] Correctly calculate endpage (diewald)

0.62.6 2024-06-13
- [feature] Make match expansion configurable (close #150, margaretha)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/ids_mannheim/korap/response/Match.java
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ public List<int[]> retrieveMarkers (LeafReaderContext atomic,
if (pagebreaks.get(i)[0] <= this.getStartPos()) {
this.startPage = pagebreaks.get(i)[1];
} else {
i++;
// i++;
break;
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ public void testPageBreakDocLowerThanLocalDocId () throws IOException {
kr.getMatch(2).getSnippetHTML());
assertEquals("{%528}abcab[[{%529}c]]ab{%530}ac",
kr.getMatch(2).getSnippetBrackets());
assertEquals(-1, kr.getMatch(2).getEndPage()); // Debatable
assertEquals(-1, kr.getMatch(2).getEndPage());

assertEquals(9, kr.getMatch(3).getStartPos());
assertEquals(10, kr.getMatch(3).getEndPos());
assertEquals(530, kr.getMatch(3).getStartPage());
assertEquals(-1, kr.getMatch(3).getEndPage());
assertEquals("<span class=\"context-left\"><span class=\"more\"></span>ab<span class=\"pb\" data-after=\"529\"></span>cab<span class=\"pb\" data-after=\"530\"></span>a</span><span class=\"match\"><mark>c</mark></span><span class=\"context-right\"></span>",
kr.getMatch(3).getSnippetHTML());
assertEquals("... ab{%529}cab{%530}a[[c]]",
kr.getMatch(3).getSnippetBrackets());
};

@Test
Expand Down Expand Up @@ -147,7 +151,7 @@ public void indexExample1 () throws Exception {
kr = ki.search(sq, (short) 10);

assertEquals(528, kr.getMatch(0).getStartPage());
assertEquals(-1, kr.getMatch(0).getEndPage());
assertEquals(529, kr.getMatch(0).getEndPage());

assertEquals(
"snippetHTML",
Expand Down

0 comments on commit 37e2e8a

Please sign in to comment.