Test sorting on numeric fields without specifying missing value behavior

Description

UPDATE: this was originally filed as a bug claiming there could be an NPE in this case. This assertion was wrong, however we indeed used not to test this scenario, so we're still going to merge a patch to expand the test coverage.


Original ticket description:

I did not check, but judging from the code that is what will happen. See how OnTheFlyNestedSorted (renamed to DocValuesJoin after ) accepts primitive values for the missingValue parameter, while the caller hold an object value which should be null when the user didn't call .missingLast()/.missingAs()/.missingFirst().

We should add a test and fix this.

Ideally we should make OnTheFlyNestedSorted/DocValuesJoin accept a null missingValue and return false from advanceExact when a value is missing. This would allow using the same class for projections on docvalues.

If it's too hard to implement, another solution (perhaps easier) would be to just set a default missingValue to 0.0f, for example. That's how org.apache.lucene.search.FieldComparator.FloatComparator#getValueForDoc behaves when a value is not found in a document anyway.

I'm not sure setting a default "missing value behavior" would be the solution: maybe Lucene has a built-in

Environment

None

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Major
Configure