if (queryString.length() > 0)
{ Query query = qp.parse(queryString.toString());
QueryScorer qScorer = new QueryScorer(query);
SimpleHTMLFormatter formatter = new SimpleHTMLFormatter("<span class=\"hlight\">", "</span>");
Highlighter highlighter = new Highlighter(formatter, qScorer);
Fragmenter fragmenter = new SimpleFragmenter(80); //*-- use fragments of 50 bytes each
highlighter.setTextFragmenter(fragmenter);
TokenStream tokenStream = sAnalyzer.tokenStream("contents", new StringReader(text));
result = highlighter.getBestFragments(tokenStream, text, 3, "...<br>"); //*-- collect upto three fragments
}
}