sorting of documents during ingestion