 <p>EDIT: added some details about explain().</p> <p>Some general introduction: The Lucene Highlighter is meant to find text snippets from a hit document, and to highlight tokens matching the query.</p> <ol> <li>Therefore, The TokenStream parameter is used to break the hit text into tokens. The highlighter's scorer then scores each token, in order to score fragments and choose snippets and tokens to be highlighted.</li> <li>I believe you are doing it wrong. If all you want to do is understand which query terms were matched in the document, you should use the <a href="http://lucene.apache.org/java/3_0_1/api/core/org/apache/lucene/search/Searcher.html#explain%28org.apache.lucene.search.Query,%20int%29" rel="nofollow noreferrer">explain()</a> method. Basically, after you have instantiated a searcher, use:</li> </ol> <p><code>Explanation expl = searcher.explain(query, docId);</code></p> <p><code>String asText = expl.toString();</code> </p> <p><code>String asHtml = expl.toHtml();</code> </p> <p>docId is the raw document id from the search results.</p> <p>Only if you do need the snippets and/or highlights, you should use the Highlighter. If you still want to use the highlighter, follow <a href="http://hrycan.com/2009/10/25/lucene-highlighter-howto/" rel="nofollow noreferrer">Nicholas Hrychan's advice</a>. Beware, though, as he describes the Lucene 2.4.1 API - If you use a more advanced version, you should use "QueryScorer" where he says "SpanScorer" .</p>