diff --git a/Changes b/Changes index b0448c8c..b1935da3 100644 --- a/Changes +++ b/Changes @@ -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) 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 76be86e9..5340e2f9 100644 --- a/src/main/java/de/ids_mannheim/korap/response/Match.java +++ b/src/main/java/de/ids_mannheim/korap/response/Match.java @@ -1106,7 +1106,7 @@ public List retrieveMarkers (LeafReaderContext atomic, if (pagebreaks.get(i)[0] <= this.getStartPos()) { this.startPage = pagebreaks.get(i)[1]; } else { - i++; + // i++; break; }; }; diff --git a/src/test/java/de/ids_mannheim/korap/index/TestPagebreakIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestPagebreakIndex.java index fc612ace..f27f21b8 100644 --- a/src/test/java/de/ids_mannheim/korap/index/TestPagebreakIndex.java +++ b/src/test/java/de/ids_mannheim/korap/index/TestPagebreakIndex.java @@ -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("abcabac", + kr.getMatch(3).getSnippetHTML()); + assertEquals("... ab{%529}cab{%530}a[[c]]", + kr.getMatch(3).getSnippetBrackets()); }; @Test @@ -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",