lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Ranking docs with all terms higher
Date Thu, 19 May 2011 12:34:03 GMT
I believe Lucene already does this, with the 'coord' factor in
BooleanQuery, which is on by default (ie, if you just "new

Ie your doc c will get a coord factor of 1.0, doc b gets 0.666..., doc
a gets 0.3333.

That said, if the term freq is high enough (ie doc a has nacho 4
times), that may give it a high enough score to overcome its coord
disadvantage (I'm not sure).


On Wed, May 18, 2011 at 10:14 PM, Christopher Condit <> wrote:
> Let's say I have the query
> (nacho OR foo OR bar)
> and some documents (single field with norms off)
> doc a: nacho nacho nacho nacho
> doc b: foo bar bar
> doc c: nacho foo bar
> I'm interested in all of these documents but I would like c to score the
> highest since it contains all of the search terms, b to score second
> because it has two, and a to score the third because it has one. What's
> the best way to get Lucene to do this?
> Thanks,
> -Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message