Wednesday, September 17, 2008

Lucene doesn't provide details as to which field the match was on?

I've now spent around 4 hours trying to figure out if there is a way for Lucene to give me information as to on which fields was the match exactly found.

The IndexReader.explain() method gives this information, however the documentation specifically mentions that this method should not be used in production level code as its gonna be slow.

At the moment as a workaround I am going to explicitly extract the value of the field from the Document and string compare it with the given search string to check whether there is a match.

Let me know if anyone has any other findings.

No comments: