diff --git a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java index e1908a2c4b6..058f1467f7d 100644 --- a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java +++ b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java @@ -41,6 +41,7 @@ import org.apache.lucene.search.highlight.QueryScorer; import org.apache.lucene.search.highlight.SimpleHTMLFormatter; import org.apache.lucene.search.highlight.TextFragment; import org.apache.lucene.search.highlight.TokenSources; +import org.apache.lucene.search.highlight.InvalidTokenOffsetsException; import org.apache.lucene.store.Directory; @@ -238,7 +239,7 @@ public abstract class ReadTask extends PerfTask { return false; } - protected int doHighlight(TokenStream ts, String text, Highlighter highlighter, boolean mergeContiguous, int maxFragments) throws IOException { + protected int doHighlight(TokenStream ts, String text, Highlighter highlighter, boolean mergeContiguous, int maxFragments) throws IOException, InvalidTokenOffsetsException { TextFragment[] frag = highlighter.getBestTextFragments(ts, text, mergeContiguous, maxFragments); return frag != null ? frag.length : 0; } diff --git a/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingHighlighterTestTask.java b/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingHighlighterTestTask.java index 1bce22acccf..f5031a0292d 100644 --- a/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingHighlighterTestTask.java +++ b/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingHighlighterTestTask.java @@ -21,6 +21,7 @@ import org.apache.lucene.benchmark.byTask.PerfRunData; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.search.highlight.Highlighter; import org.apache.lucene.search.highlight.TextFragment; +import org.apache.lucene.search.highlight.InvalidTokenOffsetsException; import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexReader; @@ -46,11 +47,9 @@ public class CountingHighlighterTestTask extends SearchTravRetHighlightTask { return document; } - protected int doHighlight(TokenStream ts, String text, Highlighter highlighter, boolean mergeContiguous, int maxFragments) throws IOException { + protected int doHighlight(TokenStream ts, String text, Highlighter highlighter, boolean mergeContiguous, int maxFragments) throws IOException, InvalidTokenOffsetsException { TextFragment[] frag = highlighter.getBestTextFragments(ts, text, mergeContiguous, maxFragments); numHighlightedResults += frag != null ? frag.length : 0; return frag != null ? frag.length : 0; } - - } \ No newline at end of file