From 5ab505be33256c1d338d9abeef2f78633c4cd89a Mon Sep 17 00:00:00 2001 From: Samyak S Sarnayak Date: Mon, 17 Jan 2022 13:02:55 +0530 Subject: [PATCH] Fix highlight by replacing num_graphemes_from_bytes num_graphemes_from_bytes has been renamed in the tokenizer to num_chars_from_bytes. Highlight now works correctly! --- milli/src/search/matching_words.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/milli/src/search/matching_words.rs b/milli/src/search/matching_words.rs index 6df2e0121..74ff14382 100644 --- a/milli/src/search/matching_words.rs +++ b/milli/src/search/matching_words.rs @@ -40,11 +40,11 @@ impl MatchingWords { Distance::Exact(t) if t <= *typo => { if *is_prefix { let len = bytes_to_highlight(word_to_highlight.text(), query_word); - Some(word_to_highlight.num_graphemes_from_bytes(len)) + Some(word_to_highlight.num_chars_from_bytes(len)) } else { Some( word_to_highlight - .num_graphemes_from_bytes(word_to_highlight.text().len()), + .num_chars_from_bytes(word_to_highlight.text().len()), ) } }