I'm not 100% sure, but I think you could use Lucene's scoring for this. So
if you ran your query and received N results, loop through them and check
the scoring explanation (which I'm not quite sure how to acquire). This
should tell you how many terms out of the query were found. This approach
should work fine if all terms have the same frequency throughout the docs.
If there is one term which is highly frequent in one of the docs, this might
fail.

But again, I'm no Lucene pro. I would love to hear an answer myself from one
of the Lucene wiz-es.

Itamar.

-----Original Message-----
From: Dipsy Kapoor [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 30, 2008 8:43 PM
To: java-user@lucene.apache.org
Subject: Retrieving documents that match atleast n query terms

Hi,

I am using a BooleanQuery of the form:
   T1 OR T2 OR T3 OR ...... Tn
to search on a  field in Lucene.

Is there a way to force the search to return documents that match at least
say 5 of the query Terms?

Thanks,
Dipsy Kapoor

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to