From 8046ae4bd570b092a98c424dfbd4f5ac3e0678cc Mon Sep 17 00:00:00 2001 From: many Date: Tue, 28 Sep 2021 12:10:43 +0200 Subject: [PATCH] Count the number of char instead of counting bytes to assign the typo tolerance --- milli/src/search/query_tree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index 8fa24b9d3..0744231ae 100644 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -262,7 +262,7 @@ fn split_best_frequency(ctx: &impl Context, word: &str) -> heed::Result QueryKind { if authorize_typos { - match word.len() { + match word.chars().count() { 0..=4 => QueryKind::exact(word), 5..=8 => QueryKind::tolerant(1, word), _ => QueryKind::tolerant(2, word),