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

Adrien Grand commented on LUCENE-5837:
--------------------------------------

Uwe, please read the issue again: the goal was not to remove the null check, 
but the check for missing values.

The reason why I came up with this issue is that I'm writing a selector in 
order to sort based on the values of a block of documents. To make it work 
efficiently I need to write a NumericDocValues instance that already returns 
the missing value when there are either no child documents in the block or if 
none of them have a value. So there is no need to check the missing values in 
the comparator.

I'm surprised that you think of it as a specialization as this is actually 
making things simpler? The handling of the missing value is done once for all 
in setNextReader and then the comparator only needs to care about the 
NumericDocValues instance. And it makes it easier (and potentially more 
efficient) to write selectors.

> Only check docsWithField when necessary in numeric comparators
> --------------------------------------------------------------
>
>                 Key: LUCENE-5837
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5837
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>             Fix For: 5.0, 4.10
>
>         Attachments: LUCENE-5837.patch, LUCENE-5837.patch
>
>
> Our numeric comparators have branches to deal with missing values. However 
> there are some cases when checking docs that have a field is not useful:
>  - if all docs have a value
>  - if no docs have a value
>  - if the missing value is 0



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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

Reply via email to