mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 12:35:05 +08:00
Count the number of char instead of counting bytes to assign the typo tolerance
This commit is contained in:
parent
1988416295
commit
8046ae4bd5
@ -262,7 +262,7 @@ fn split_best_frequency(ctx: &impl Context, word: &str) -> heed::Result<Option<O
|
|||||||
/// and the provided word length.
|
/// and the provided word length.
|
||||||
fn typos(word: String, authorize_typos: bool) -> QueryKind {
|
fn typos(word: String, authorize_typos: bool) -> QueryKind {
|
||||||
if authorize_typos {
|
if authorize_typos {
|
||||||
match word.len() {
|
match word.chars().count() {
|
||||||
0..=4 => QueryKind::exact(word),
|
0..=4 => QueryKind::exact(word),
|
||||||
5..=8 => QueryKind::tolerant(1, word),
|
5..=8 => QueryKind::tolerant(1, word),
|
||||||
_ => QueryKind::tolerant(2, word),
|
_ => QueryKind::tolerant(2, word),
|
||||||
|
Loading…
Reference in New Issue
Block a user