From 7e2fd82e41c3cb0c9d241adb24f3d6c4fd888cc5 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Wed, 8 Mar 2023 12:44:16 +0100 Subject: [PATCH] Use Language allow list in the highlighter --- meilisearch/src/search.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meilisearch/src/search.rs b/meilisearch/src/search.rs index c287f1ba0..ebf9ace1f 100644 --- a/meilisearch/src/search.rs +++ b/meilisearch/src/search.rs @@ -378,6 +378,11 @@ pub fn perform_search( let mut tokenizer_buidler = TokenizerBuilder::default(); tokenizer_buidler.create_char_map(true); + let script_lang_map = index.script_language(&rtxn)?; + if !script_lang_map.is_empty() { + tokenizer_buidler.allow_list(&script_lang_map); + } + let mut formatter_builder = MatcherBuilder::new(matching_words, tokenizer_buidler.build()); formatter_builder.crop_marker(query.crop_marker); formatter_builder.highlight_prefix(query.highlight_pre_tag);