From 80d34a41699d33bc03f7d9e47984fd0bbfe306a0 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Mon, 12 Dec 2022 19:02:48 +0100 Subject: [PATCH 1/2] Fix typo initial candiddates computation --- milli/src/search/criteria/typo.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/milli/src/search/criteria/typo.rs b/milli/src/search/criteria/typo.rs index 56cffd232..154aa2d8e 100644 --- a/milli/src/search/criteria/typo.rs +++ b/milli/src/search/criteria/typo.rs @@ -141,7 +141,12 @@ impl<'t> Criterion for Typo<'t> { filtered_candidates, initial_candidates, }) => { - self.initial_candidates = initial_candidates; + self.initial_candidates = + match (self.initial_candidates.take(), initial_candidates) { + (Some(self_bc), Some(parent_bc)) => Some(self_bc | parent_bc), + (self_bc, parent_bc) => self_bc.or(parent_bc), + }; + let candidates = match candidates.or(filtered_candidates) { Some(candidates) => { Candidates::Allowed(candidates - params.excluded_candidates) From 2d8d0af1a6549012bd04cf6472b234e431a26fbe Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Tue, 13 Dec 2022 10:56:38 +0100 Subject: [PATCH 2/2] Rename short name bc by ic for initial_candidates --- milli/src/search/criteria/typo.rs | 4 ++-- milli/src/search/criteria/words.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/milli/src/search/criteria/typo.rs b/milli/src/search/criteria/typo.rs index 154aa2d8e..20bc718fd 100644 --- a/milli/src/search/criteria/typo.rs +++ b/milli/src/search/criteria/typo.rs @@ -143,8 +143,8 @@ impl<'t> Criterion for Typo<'t> { }) => { self.initial_candidates = match (self.initial_candidates.take(), initial_candidates) { - (Some(self_bc), Some(parent_bc)) => Some(self_bc | parent_bc), - (self_bc, parent_bc) => self_bc.or(parent_bc), + (Some(self_ic), Some(parent_ic)) => Some(self_ic | parent_ic), + (self_ic, parent_ic) => self_ic.or(parent_ic), }; let candidates = match candidates.or(filtered_candidates) { diff --git a/milli/src/search/criteria/words.rs b/milli/src/search/criteria/words.rs index 181749b60..4c5f8b45b 100644 --- a/milli/src/search/criteria/words.rs +++ b/milli/src/search/criteria/words.rs @@ -74,8 +74,8 @@ impl<'t> Criterion for Words<'t> { self.initial_candidates = match (self.initial_candidates.take(), initial_candidates) { - (Some(self_bc), Some(parent_bc)) => Some(self_bc | parent_bc), - (self_bc, parent_bc) => self_bc.or(parent_bc), + (Some(self_ic), Some(parent_ic)) => Some(self_ic | parent_ic), + (self_ic, parent_ic) => self_ic.or(parent_ic), }; } Some(CriterionResult {