lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Koji Sekiguchi <k...@r.email.ne.jp>
Subject Re: Highlighting matching words within a document
Date Sat, 18 Jun 2011 14:52:01 GMT
(11/06/18 20:35), SBS wrote:
> This is my first look at Lucene and I am sure this must be a common problem.
> I have managed to index all my content and get results from queries but the
> question is how do I highlight the matches in a document?  I mean I have
> some HTML documents and then I need to display somehow the occurrences
> within those documents that match the query.
>
> If the query was a single word then the problem is quite easy but when you
> consider that the query can be complex and contain wildcards and compound
> expressions, how can I know which words or partial words within the document
> are the reasons for the document being returned as a match?

Lucene do not only search documents but also highlight matched terms in the documents for
you.

Please look at:

http://lucene.apache.org/java/3_2_0/api/all/org/apache/lucene/search/highlight/package-summary.html#package_description

koji
-- 
http://www.rondhuit.com/en/

Mime
View raw message