Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 406ee31

Browse files
Merge #737
737: Fix typo initial candidates computation r=Kerollmops a=ManyTheFish When `Typo` criterion was after a different criterion than `Words` and the previous criterion wasn't returning any candidates at the first iteration of the bucket sort, then the `initial_candidates` were lost. Now, `Typo`ensure to keep the `initial_candidates` between iterations. related to meilisearch/meilisearch#3200 (comment) related to meilisearch/meilisearch#3228 Co-authored-by: ManyTheFish <[email protected]>
2 parents e0a8f8c + 2d8d0af commit 406ee31

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

milli/src/search/criteria/typo.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ impl<'t> Criterion for Typo<'t> {
141141
filtered_candidates,
142142
initial_candidates,
143143
}) => {
144-
self.initial_candidates = initial_candidates;
144+
self.initial_candidates =
145+
match (self.initial_candidates.take(), initial_candidates) {
146+
(Some(self_ic), Some(parent_ic)) => Some(self_ic | parent_ic),
147+
(self_ic, parent_ic) => self_ic.or(parent_ic),
148+
};
149+
145150
let candidates = match candidates.or(filtered_candidates) {
146151
Some(candidates) => {
147152
Candidates::Allowed(candidates - params.excluded_candidates)

milli/src/search/criteria/words.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ impl<'t> Criterion for Words<'t> {
7474

7575
self.initial_candidates =
7676
match (self.initial_candidates.take(), initial_candidates) {
77-
(Some(self_bc), Some(parent_bc)) => Some(self_bc | parent_bc),
78-
(self_bc, parent_bc) => self_bc.or(parent_bc),
77+
(Some(self_ic), Some(parent_ic)) => Some(self_ic | parent_ic),
78+
(self_ic, parent_ic) => self_ic.or(parent_ic),
7979
};
8080
}
8181
Some(CriterionResult {

0 commit comments

Comments
 (0)