mirror of https://github.com/apache/lucene.git
LUCENE-1500: fix compilation errors in contrib/benchmark by allowing doHighlight method to throw InvalidTokenOfsetsException
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@758575 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
73a02ec6fe
commit
198aa70b35
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue