lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] [Commented] (SOLR-4723) sort order different in branch_4x than trunk
Date Tue, 16 Apr 2013 21:23:17 GMT


Uwe Schindler commented on SOLR-4723:

The pre-trunk code is wrong for comparing doubles/floats, as v1 > v2 does not work with
+/-0 (its identical for operators <, >, ==). In Java 7, Double/ compares
the bits.

The easiest way to solve the problem is using NumericUtils.doubleToSortableLong/floatToSortableInt
and then compare the long/int. NumericUtils converts the floating point value to an integer,
with fixing the sign to be comparable like a int (see javadocs).

I think this is a corner case (like the crazy bugs if the score is NaN), so maybe we should
only fix in 5.0 but leave 4.x and all previous lucene versions as they are.
> sort order different in branch_4x than trunk
> --------------------------------------------
>                 Key: SOLR-4723
>                 URL:
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: SOLR-4723_test.patch
> I will buy a beer to whoever figures out why +0 sorts before -0 in branch_4x, but works
correctly in trunk :)

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

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

View raw message