From 8de3c9f737a092b8aaf7b4dc6587659b11ac3747 Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 14 Feb 2023 17:57:14 +0100 Subject: [PATCH] Update milli/src/update/index_documents/transform.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Renault --- milli/src/update/index_documents/transform.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/milli/src/update/index_documents/transform.rs b/milli/src/update/index_documents/transform.rs index 05e7089b7..9d07dc871 100644 --- a/milli/src/update/index_documents/transform.rs +++ b/milli/src/update/index_documents/transform.rs @@ -786,9 +786,8 @@ fn merge_obkvs_and_operations<'a>(_key: &[u8], obkvs: &[Cow<'a, [u8]>]) -> Resul // we can ignore everything that happened before the last delete. let starting_position = obkvs .iter() - .rev() - .position(|obkv| obkv[0] == Operation::Deletion as u8) - .map_or(0, |pos| obkvs.len() - pos); + .rposition(|obkv| obkv[0] == Operation::Deletion as u8) + .unwrap_or(0); // [add, add, delete] // if the last operation was a deletion then we simply return the deletion