From 40dd25d6b2c60a70873ed828ec3b8e4404d44900 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 13 Nov 2024 22:09:36 +0100 Subject: [PATCH] Fix issue with Replace document method when adding and deleting a document in the same batch --- crates/milli/src/update/new/indexer/document_operation.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/milli/src/update/new/indexer/document_operation.rs b/crates/milli/src/update/new/indexer/document_operation.rs index c0f1ffbdd..d4f11389a 100644 --- a/crates/milli/src/update/new/indexer/document_operation.rs +++ b/crates/milli/src/update/new/indexer/document_operation.rs @@ -310,10 +310,10 @@ impl MergeChanges for MergeDocumentForReplacement { } Some(InnerDocOp::Deletion) => { return if is_new { + Ok(None) + } else { let deletion = Deletion::create(docid, external_doc); Ok(Some(DocumentChange::Deletion(deletion))) - } else { - Ok(None) }; } None => unreachable!("We must not have empty set of operations on a document"),