// The HTML escaping forces us to first fragment with internal placeholders...
Highlighter highlighter = new Highlighter(new SimpleHTMLFormatter(INTERNAL_BEGIN_HIT, INTERNAL_END_HIT), new QueryScorer(query));
highlighter.setTextFragmenter(fragmenter);
try {
// Use the same analyzer as the indexer!
TokenStream tokenStream = new StandardAnalyzer().tokenStream(null, new StringReader(indexedText));
String unescapedFragements =
highlighter.getBestFragments(tokenStream, indexedText, numOfFragments, getFragmentSeparator());
String escapedFragments = WikiUtil.escapeHtml(WikiUtil.removeMacros(unescapedFragements), false, false);