Update milli/src/update/index_documents/transform.rs

Co-authored-by: Clément Renault <clement@meilisearch.com>
This commit is contained in:
Tamo 2023-02-14 17:57:14 +01:00 committed by GitHub
parent 43a19d0709
commit 8de3c9f737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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. // we can ignore everything that happened before the last delete.
let starting_position = obkvs let starting_position = obkvs
.iter() .iter()
.rev() .rposition(|obkv| obkv[0] == Operation::Deletion as u8)
.position(|obkv| obkv[0] == Operation::Deletion as u8) .unwrap_or(0);
.map_or(0, |pos| obkvs.len() - pos);
// [add, add, delete] // [add, add, delete]
// if the last operation was a deletion then we simply return the deletion // if the last operation was a deletion then we simply return the deletion