GitHub user laimis opened a pull request:

    https://github.com/apache/lucenenet/pull/47

    Use reference instead of value type to match Lucene's logic

    Introduce a nullable long in DocValuesConsumer, instead of using just long. 
The need for this is best illustrated if you look at the changes in 
Lucene45DocValuesConsumer and in NumericDocValuesWriter. The Writer had 
iterator implementation that did not match Lucene version, ignoring cases of 
DocsWithField.Get(doc) evaluating to false in which case a null value needs to 
be returned. Null value executes a code branch in Lucene45DocValuesConsumer 
that was simply ignored before. The result of that is the resulting index 
structure being incorrect, and requests such as DocsWithFields would return 
true for all documents even though the index had documents that did not have a 
field in question. 
    
    The tests that used to break are in TestLucene45DocValuesFormat and 
TestPerFieldDocValuesFormat, e.g. 
BaseDocValuesFormatTestCase.TestTwoNumbersOneMissing. This fixes about 20 
failing tests by my count.
    
    I was considering porting over Numeric class over, but I think we can do 
that in stages, if necessary. Since all the signatures were using long, 
migrating to long? was the first step to get the logic right and tests passing. 
And then we can improve on the approach itself.
    
    I think I see more code places where iterators have been ported incorrectly 
and numbers are used in non-nullable form causing different code execution 
paths, but will get those as we go down the list of failing tests.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/laimis/lucenenet 
NumericDocValuesWriter_iterator_fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucenenet/pull/47.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #47
    
----
commit cd4e2e19f1895313e28f01c1bb1673a99c472a5f
Author: Laimonas Simutis <[email protected]>
Date:   2015-01-15T11:03:22Z

    use reference instead of value type to match Lucene's logic

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to