From 3c158818187313eec79684ac498e43fd71e47409 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 25 Oct 2023 17:32:36 +0200 Subject: [PATCH] Add simple delete test --- milli/src/index.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/milli/src/index.rs b/milli/src/index.rs index a280a1a48..481f698fc 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -2332,6 +2332,32 @@ pub(crate) mod tests { "###); } + #[test] + fn simple_delete() { + let mut index = TempIndex::new(); + index.index_documents_config.update_method = IndexDocumentsMethod::UpdateDocuments; + index + .add_documents(documents!([ + { "id": 30 }, + { "id": 34 } + ])) + .unwrap(); + + db_snap!(index, documents_ids, @"[0, 1, ]"); + db_snap!(index, external_documents_ids, 1, @r###" + docids: + 30 0 + 34 1"###); + + index.delete_document("34"); + + db_snap!(index, documents_ids, @"[0, ]"); + db_snap!(index, external_documents_ids, 2, @r###" + docids: + 30 0 + "###); + } + #[test] fn bug_3021_second() { // https://github.com/meilisearch/meilisearch/issues/3021