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

Adrien Grand commented on LUCENE-7548:
--------------------------------------

The default for numeric fields is indeed to treat missing values as a zero. I 
think it has been this way for a long time. That said, I'b be fine with 
reconsidering and using MAX_VALUE when sorting in ascending order and MIN_VALUE 
when sorting in descending order, which is not exactly sorting missing values 
last but probably close enough for most users. This might have a slight 
performance impact on 6.x since doc value formats have to return 0 for 
documents which do not have a value, which makes using 0 as a missing value 
more efficient since the comparator does not have to check {{docsWithField}}. 
In master however since the format is sparse anyway, this should not matter.

> Docvalues sorting treats empty values as the default
> ----------------------------------------------------
>
>                 Key: LUCENE-7548
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7548
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Erick Erickson
>
> I found this working on Solr, Mike suggested I raise it as a Lucene issue.
> This was for int fields, I'll assume the same holds for other types.
> The sort order is as though the null field was explicitly set to zero, the 
> whole idea of sorting missing first is lost.
> doc1
> int_dv = 0
> int_sort = 1
> doc2
> int_sort=2
> doc3
> int_dv = 0
> int_sort=3
> sort by int_dv asc,int_sort asc gives
> doc1
> doc2
> doc3
> when it should give
> doc2
> doc1
> doc3



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to