lucene-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/SOLR-4723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13633382#comment-13633382
] 

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/Float.compare() 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: https://issues.apache.org/jira/browse/SOLR-4723
>             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: http://www.atlassian.com/software/jira

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


Mime
View raw message