From e2eff7deaee5d7c380d0cb930186c62fa0309de5 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 20 Mar 2022 15:36:54 +1000 Subject: [PATCH] Fix change notetype affecting cards outside selection Accidentally introduced by the search refactoring in #1600, this lead to a query that matched items outside of the selected notes, eg (n.id in (1506029488152) and c.ord = 43 or c.ord = 4) Closes #1727 --- rslib/src/notetype/notetypechange.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rslib/src/notetype/notetypechange.rs b/rslib/src/notetype/notetypechange.rs index 61ba43ee5..000030744 100644 --- a/rslib/src/notetype/notetypechange.rs +++ b/rslib/src/notetype/notetypechange.rs @@ -314,13 +314,13 @@ impl Collection { usn: Usn, ) -> Result<(), AnkiError> { if !map.remapped.is_empty() { - let mut ords = SearchBuilder::any( + let ords = SearchBuilder::any( map.remapped .keys() .map(|o| TemplateKind::Ordinal(*o as u16)), ); self.search_cards_into_table( - SearchBuilder::from(nids).and_join(&mut ords), + SearchBuilder::from(nids).and_join(&mut ords.group()), SortMode::NoOrder, )?; for mut card in self.storage.all_searched_cards()? {