Hello,

When sorting documents by a NumericDocValuesField, how can documents be
ordered such that those with missing values can come before anything else
in ascending sorts? SortField allows to set a missing value:

    var sortField = new SortField("price", SortField.Type.LONG);
    sortField.setMissingValue(null);

This null is however converted into a long 0 and documents with missing
values are considered equally ordered with documents with an actual 0
value. It's possible to set the missing value to Long.MIN_VALUE, but that
will have the same problem, just for a different long value.

Besides writing a custom comparator, is there any simpler and still
performant way to achieve this sort?

--Petko

Reply via email to