lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: question about code in FunctionQuery#score
Date Mon, 08 Jun 2009 13:47:04 GMT
On Mon, Jun 8, 2009 at 9:38 AM, Mark Miller <markrmiller@gmail.com> wrote:
> We have score!=score (same variable) - just wondering what that was trying
> to accomplish, or whether it can just be dropped.

Good thing you checked :-)

> Its also in BoostedQuery,
> so it almost seems on purpose. Even with a float, score has got to equal
> score, right? Is this some tricky check I don't understand, or a mistake?

The purpose is alluded to in the comments.  If a var is NaN (not a
number) it doesn't even compare equal to itself.

-Yonik
http://www.lucidimagination.com

>     // current Lucene sorting priority queues can't handle NaN and -Infinity
>     if (score != score || score==Float.NEGATIVE_INFINITY) return
> -Float.MAX_VALUE;
>     return score;
>   }

Mime
View raw message