Allow custom sorting for documents and nodes