Improved document key sorting and support for struct document ids

Support sorting of struct based document ids

---

Introduce sortableDocKey

Precompute the nature and sort value for each doc key once instead of
each time Less is called. This trades slight additional complexity and
memory usage for sort speed. This also paves the way for sorting of
struct document keys.

---

Removed unnecessary resort of document keys