lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Rowe <>
Subject Re: Using Lucene to search log files
Date Mon, 11 Dec 2006 17:12:15 GMT
abdul aleem wrote:
> How to actually retrieve the content of search,
> Most of the examples in Lucene in Action 
> Searcher gives the results found in number of
> documents 
> but i coudln't find an API to retrieve the line or
> paragraph where the search is matched

Hi Abdul,

I don't know what your log files look like -- how have you defined your
Lucene document?  The document is the only level of granularity
available for returning hits in Lucene.

Something you should look at, though, is Mark Harwood's Highlighter
package, which is part of the Lucene Sandbox.  This package can be used
to break documents into fragments, to score those fragments based on a
supplied query, and then to highlight the terms from the query.  Below
is a link to the API docs:

You can find a description of using this package in "Lucene in Action",
in Section 8.7.

The Highlighter distribution .jar is packed inside of,
available from Apache mirrors:

Also, the JUnit tests are a good place to see how to use this package:

Hope it helps,

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

View raw message