You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ramdas M Ramakrishnan <ra...@us.ibm.com> on 2008/03/18 15:44:33 UTC

Question with Hits Interface

Hi

I am using a MultiFieldQueryParser to parse and search the index. Once I
have the Hits and iterate thru it, I need to know the following?

For every hit document I need to know under which indexed field was this
Hit originating from? Say I have indexed 2 Fields how will I know from the
Hit which Field the Hit came from?

Thanks in advance.

Rgds
Ram

Re: Question with Hits Interface

Posted by Daniel Noll <da...@nuix.com>.
On Wednesday 19 March 2008 01:44:33 Ramdas M Ramakrishnan wrote:
> I am using a MultiFieldQueryParser to parse and search the index. Once I
> have the Hits and iterate thru it, I need to know the following?
>
> For every hit document I need to know under which indexed field was this
> Hit originating from? Say I have indexed 2 Fields how will I know from the
> Hit which Field the Hit came from?

query.createWeight(searcher).explain(reader, docId) ?

Or just look at the text.

Why do you need to know this anyway?  If it's for sorting title matches 
higher, you're supposed to use boosting for that.  If it's for highlighting 
then the highlighter would do nothing if there are no matches.

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org