GeeCON Prague 2014*
The moose likes Other Open Source Projects and the fly likes how to get the search words in result hits in Lucene. Help please!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "how to get the search words in result hits in Lucene. Help please!!!" Watch "how to get the search words in result hits in Lucene. Help please!!!" New topic
Author

how to get the search words in result hits in Lucene. Help please!!!

jonathan ford
Greenhorn

Joined: Feb 16, 2008
Posts: 4
For example:
search term = "java OR struts OR development OR spring OR framework"

I can use Searcher.search() to get the result hits. and I can use hits.doc() to retrieve document information.

here is my question: for each document in result hits, How I can know which words in search term just match the words in the result document? i.e. I get a document, which content contains the words: spring and framework, that's the reason this document got hit. is there possible to get these two words "spring" and "framework" in programmatic way.

any suggestions and clues will be much appreciated!!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to get the search words in result hits in Lucene. Help please!!!