Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
6.0
-
None
-
None
-
New
Description
public static void highLightClojure(int id, String text, String field) {
try {
Query queryToSearch;
TokenStream tokenStream = TokenSources.getTokenStream( field,text, analyzer);
queryToSearch = new QueryParser("asddf", analyzer).parse("read text file string utf8");
Highlighter highlighter = new Highlighter(new SimpleHTMLFormatter(),
new QueryScorer(queryToSearch));
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, text, false, 4);
for (int j = 0; j < frag.length; j++) {
if ((frag[j] != null))
}
} catch (IOException e)
catch (ParseException e)
{ // TODO Auto-generated catch block e.printStackTrace(); }}
Exception:
TokenStream contract violation: reset()/close() call missing,
reset() called multiple times, or subclass does not call
super.reset(). Please see Javadocs of TokenStream class for more
information about the correct consuming workflow.
The tokenStream must be created after QueryParser, its an implicit dependency, but no any information mentioned it.