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-2134) Trie* fields should support sortMissingLast=true, and deprecate Sortable* Field Types
Date Tue, 28 Sep 2010 16:58:33 GMT

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

Uwe Schindler commented on SOLR-2134:
-------------------------------------

NaN is always returning false when compared to anything. Its not JVM dependent it is mathematical
correct and defined in IEEE-754 standard: [http://en.wikipedia.org/wiki/NaN], [http://forums.sun.com/thread.jspa?threadID=5419285]

The coolest thing is how you test for NaN (from JDK source code):

{code}
public static public boolean isNaN(double v) {
  return (v != v);
}
{code}

This really returns only true for NaN, because as I said NaN always returns false in any comparison.
The problem with that in Lucene's/Solr's sorting is the fact that the PriorityQueue uses lessThan
which would return always false, in any case, so the PriorityQueue gets mixed up. You can
see that, because NaN values are mixed between the other values, dependent on the order when
they were inserted.

So to remove the method call above use:

{code}
if (cached.values[doc] != cached.values[doc]) // test for NaN
{code}

Looks pervers but is correct *g*

Not related to that: One thing about your patches, some of them already committed: Can you
please use the Lucene Coding Conventions (no extra space around if statements and the opening
{ at the end of a method declaration is in the same line). We have a Eclipse style file in
wiki.

> Trie* fields should support sortMissingLast=true, and deprecate Sortable* Field Types
> -------------------------------------------------------------------------------------
>
>                 Key: SOLR-2134
>                 URL: https://issues.apache.org/jira/browse/SOLR-2134
>             Project: Solr
>          Issue Type: Improvement
>          Components: Schema and Analysis
>            Reporter: Ryan McKinley
>         Attachments: SOLR-2134-SortMissingLast.patch, SOLR-2134-SortMissingLast.patch,
SOLR-2134-SortMissingLast.patch, SOLR-2134-SortMissingLast.patch
>
>
> With the changes in LUCENE-2649, the FieldCache also returns if the bit is valid or not.
 This is enough to support sortMissingLast=true with Trie* fields.  Then we can get rid of
the Sortable* fields

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message