Being able to specify null ordering is a common approach (see nullsFirst and nullsLast in https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html). By default cypher puts nulls last on ascending and first on descending. But that is not always desirable, e.g. when sorting priorities descending, perhaps null priorities should not be above highest priorities.
Attempted workarounds include:
- adding a
@cypher directive to COALESCE nulls into something that works. However, you cannot sort on a @cypher directive field
- adding another field with
@cypher directive to derive a sort field, but again it cannot be sorted on
A working workaround is to change the data in some way to facilitate the sort.