From b4102741e613af3a909e321b75fd476f20380187 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Mon, 14 Oct 2024 14:59:40 +0200 Subject: [PATCH] Fix duplicated fields when a document is modified --- milli/src/update/new/document.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/milli/src/update/new/document.rs b/milli/src/update/new/document.rs index 335e2c327..1fb31ceb8 100644 --- a/milli/src/update/new/document.rs +++ b/milli/src/update/new/document.rs @@ -142,9 +142,9 @@ impl<'d, 'doc: 'd, 't: 'd, Mapper: FieldIdMapper> Document<'d> fn iter_top_level_fields(&self) -> impl Iterator> { let mut new_doc_it = self.new_doc.iter_top_level_fields(); let mut db_it = self.db.iter().flat_map(|db| db.iter_top_level_fields()); + let mut seen_fields = BTreeSet::new(); std::iter::from_fn(move || { - let mut seen_fields = BTreeSet::new(); if let Some(next) = new_doc_it.next() { if let Ok((name, _)) = next { seen_fields.insert(name);