lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terence Lai <>
Subject Question on the Sandbox Highlighter
Date Tue, 05 Jul 2005 20:58:51 GMT

I am currently using Lucene 1.4.2 with the highighter downloaded from Lucene In Action.

The Highlighter class provides the following method to highlight the terms specified in the

 * Highlights chosen terms in a text, extracting the most relevant section.
 * The document text is analysed in chunks to record hit statistics
 * across the document. After accumulating stats, the fragment with the highest score
 * is returned
 * @param tokenStream   a stream of tokens identified in the text parameter, including offset
 * This is typically produced by an analyzer re-parsing a document's 
 * text. Some work may be done on retrieving TokenStreams more efficently 
 * by adding support for storing original text position data in the Lucene
 * index but this support is not currently available (as of Lucene 1.4 rc2).  
 * @param text text to highlight terms in
 * @return highlighted text fragment or null if no terms found
public final String getBestFragment(TokenStream tokenStream, String text)
       throws IOException;

According to the javadoc, this method only returns the most relevant section of the text.
Is there any way or method to return ENTIRED text with the terms being highlighted?


Get your free email account from
          Your Internet Virtual Desktop!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message