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 Itamar Syn-Hershko <it...@divrei-tora.com> on 2008/02/04 11:56:24 UTC

RE: Retrieving documents that match atleast n query terms

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:dipsykapoor@gmail.com] 
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org





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