LUCENE-9631: Properly override slice() on subclasses of OffsetRange.

This commit is contained in:
Dawid Weiss 2020-12-03 10:55:33 +01:00
parent 4c100a0175
commit a9e180b20a
3 changed files with 16 additions and 0 deletions

View File

@ -186,6 +186,8 @@ Bug fixes
Other
* LUCENE-9631: Properly override slice() on subclasses of OffsetRange. (Dawid Weiss)
* LUCENE-9312: Allow gradle builds against arbitrary JVMs. (Tomoko Uchida, Dawid Weiss)
* LUCENE-9391: Upgrade HPPC to 0.8.2. (Haoyu Zhai)

View File

@ -163,6 +163,11 @@ public class MatchHighlighter {
super(from, to);
this.query = query;
}
@Override
public QueryOffsetRange slice(int from, int to) {
return new QueryOffsetRange(query, from, to);
}
}
private static class DocHit {

View File

@ -32,6 +32,15 @@ public class Passage extends OffsetRange {
this.markers = markers;
}
/**
* Passages can't be sliced as it could split previously determined
* highlight markers.
*/
@Override
public OffsetRange slice(int from, int to) {
throw new RuntimeException("Passages.slice() does not make sense?");
}
@Override
public String toString() {
return "[" + super.toString() + ", markers=" + markers + "]";