// Assuming "<B>", "</B>" used to highlight
SimpleHTMLFormatter formatter = new SimpleHTMLFormatter();
Highlighter highlighter = new Highlighter(formatter, new SpanScorer(query, fieldName,
tokenStream, FIELD_NAME));
highlighter.setTextFragmenter(new SimpleFragmenter(Integer.MAX_VALUE));
tokenStream.reset();
String rv = highlighter.getBestFragments(tokenStream, text, 1, "(FIELD TEXT TRUNCATED)");
return rv.length() == 0 ? text : rv;
}
public void testSimpleSpanHighlighter() throws Exception {