lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <>
Subject Re: Find out which field of document matched the query
Date Thu, 01 Jun 2006 23:59:21 GMT
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 Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web:                        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:
For additional commands, e-mail:

View raw message