Frank Kunemann wrote:
Hi lucene users,
just wanted to know if there is a simple way to find out which field(s) of a
document matched the query.
In our case we have different content fields and the user can choose whether
he wants to search in all of them or just in one.
To keep the index as small as possible we don't store those fields. So when
highlighting we need to load the original files instead of just using the
document values. To optimize this a bit it would be cool to just load the
files that had hits instead of all of them.
One method might be using the explain method on the Weight interface to
get an Explanation object, but I'm not sure how many semantics the
explanation carries. It will certainly tell you which branches of your
query resulted in the the document matching, and if you're using a
simple BooleanQuery to perform this multiple field matching, then that
may be enough.
Daniel
--
Daniel Noll
Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia Ph: +61 2 9280 0699
Web: http://www.nuix.com.au/ Fax: +61 2 9212 6902
This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]