Use Language allow list in the highlighter

This commit is contained in:
ManyTheFish 2023-03-08 12:44:16 +01:00
parent 24c0775c67
commit 7e2fd82e41

View File

@ -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);