Description
This was reported by Vish Ramachandran at https://markmail.org/message/w27h7n2isb5eogos. When deleting by term or query, we record the term/query that is deleted and the current max doc id. Deletes are later applied on flush by FrozenBufferedUpdates#apply*Deletes. Unfortunately, this doesn't work when index sorting is enabled since documents are renumbered between the time that the current max doc id is computed and the time that deletes are applied.