From 4111b99a6d61b7cbb89c3c278f7dd0d5012a2147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sat, 26 Oct 2019 15:48:36 +0200 Subject: [PATCH] Only highlight query words areas not the whole words --- meilidb-core/src/query_builder.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meilidb-core/src/query_builder.rs b/meilidb-core/src/query_builder.rs index ea97f75b8..2328a4844 100644 --- a/meilidb-core/src/query_builder.rs +++ b/meilidb-core/src/query_builder.rs @@ -1,4 +1,5 @@ use hashbrown::HashMap; +use std::convert::TryFrom; use std::mem; use std::ops::Range; use std::rc::Rc; @@ -196,7 +197,7 @@ fn fetch_raw_documents( let highlight = Highlight { attribute: di.attribute, char_index: di.char_index, - char_length: di.char_length, + char_length: u16::try_from(*query_len).unwrap_or(u16::max_value()), }; tmp_matches.push((di.document_id, id, match_, highlight));