lucene get matched terms in query

Posted by iamrohitbanga on Stack Overflow See other posts from Stack Overflow or by iamrohitbanga
Published on 2010-05-17T17:58:32Z Indexed on 2010/05/17 18:00 UTC
Read the original article Hit count: 291

Filed under:
|
|

what is the best way to find out which terms in a query matched against a given document returned as a hit in lucene?

I have tried a weird method involving hit highlighting package in lucene contrib and also a method that searches for every word in the query against the top most document ("docId: xy AND description: each_word_in_query").

Do not get satisfactory results? hit highlighting does not report some of the words that matched for a document other than the first one. i am not sure if the second approach is the best alternative.

© Stack Overflow or respective owner

Related posts about lucene

Related posts about java