Sort on DateIndex where value is None

I want to be sure I understand sorting on DateIndex. It seems from my testing that if I sort on a DateIndex, any catalog brains that have no value for it are not returned in the results. In my current case, I'd prefer that they still be returned but sorted to the bottom (or possibly to the top depending on context) - it is unintuitive that a sort option would affect the total count in a search. Am I mistaken about how this should be working? This is perhaps an atypical use case because the most common date sorts would be on creation or modification date, which can never have a value of None.

One option to counter this would be to write an indexer with plone.indexer that assigns a date of some future date, or perhaps of year 1 if appropriate, if the date would otherwise be None. The downside here (for me) would be that I have to decouple index and metadata, since this decorator applies to both, and I definitely do not want the metadata to show a value for date in this context.

Well, None values are not stored in the dateindex. This is fine, we dont need them. Sorting in ZCatalog works by ordering the result against an index order. The index uses an OIBTree, which is ordered by value by its btreeish nature. It is used as ordering keys. In the ordering process the result is skipped. In code read further here ff:

How to solve your problem:

Create a custom FieldIndex and an indexer function (package plone.indexing) returning the date/time as special shorted UTC ISO-like 202001181259. On None return 0 or 999999999999 (depends on None at top or end of result).

Then use this index for sorting only.