diff --git a/meilisearch-http/src/helpers/meilisearch.rs b/meilisearch-http/src/helpers/meilisearch.rs
index 2db6472ca..57186a2d8 100644
--- a/meilisearch-http/src/helpers/meilisearch.rs
+++ b/meilisearch-http/src/helpers/meilisearch.rs
@@ -597,7 +597,7 @@ mod tests {
let mut m = Vec::new();
m.push(MatchPosition {
- start: 510,
+ start: 529,
length: 9,
});
matches.insert("description".to_string(), m);
@@ -613,6 +613,7 @@ mod tests {
assert_eq!(result, result_expected);
}
+
#[test]
fn highlight_longest_match() {
let data = r#"{
diff --git a/meilisearch-http/tests/assets/test_set.json b/meilisearch-http/tests/assets/test_set.json
index 63534c896..b035ac334 100644
--- a/meilisearch-http/tests/assets/test_set.json
+++ b/meilisearch-http/tests/assets/test_set.json
@@ -1590,18 +1590,18 @@
"tags": []
},
{
- "id": 76,
+ "id": 77,
"isActive": false,
"balance": "$1,274.29",
"picture": "http://placehold.it/32x32",
"age": 25,
- "color": "Green",
- "name": "Clarice Gardner",
- "gender": "female",
- "email": "claricegardner@chorizon.com",
+ "color": "Red",
+ "name": "孙武",
+ "gender": "male",
+ "email": "SunTzu@chorizon.com",
"phone": "+1 (810) 407-3258",
- "address": "894 Brooklyn Road, Utting, New Hampshire, 6404",
- "about": "Elit occaecat aute ea adipisicing mollit cupidatat aliquip excepteur veniam minim. Sunt quis dolore in commodo aute esse quis. Lorem in cillum commodo eu anim commodo mollit. Adipisicing enim sunt adipisicing cupidatat adipisicing eiusmod eu do sit nisi.\r\n",
+ "address": "吴国",
+ "about": "孫武(前544年-前470年或前496年),字長卿,春秋時期齊國人,著名軍事家、政治家,兵家代表人物。兵書《孙子兵法》的作者,後人尊稱為孫子、兵聖、東方兵聖,山東、蘇州等地尚有祀奉孫武的廟宇兵聖廟。其族人为乐安孙氏始祖,次子孙明为富春孙氏始祖。\r\n",
"registered": "2014-10-20T10:13:32 -02:00",
"latitude": 17.11935,
"longitude": 65.38197,
diff --git a/meilisearch-http/tests/search.rs b/meilisearch-http/tests/search.rs
index 6a496809e..82804a019 100644
--- a/meilisearch-http/tests/search.rs
+++ b/meilisearch-http/tests/search.rs
@@ -358,6 +358,66 @@ async fn search_with_attribute_to_highlight_wildcard() {
});
}
+#[actix_rt::test]
+async fn search_with_attribute_to_highlight_wildcard_chinese() {
+ let mut server = common::Server::test_server().await;
+
+ let query = json!({
+ "q": "子孙",
+ "limit": 1,
+ "attributesToHighlight": ["*"]
+ });
+
+ let expected = json!([
+ {
+ "id": 77,
+ "isActive": false,
+ "balance": "$1,274.29",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "color": "Red",
+ "name": "孙武",
+ "gender": "male",
+ "email": "SunTzu@chorizon.com",
+ "phone": "+1 (810) 407-3258",
+ "address": "吴国",
+ "about": "孫武(前544年-前470年或前496年),字長卿,春秋時期齊國人,著名軍事家、政治家,兵家代表人物。兵書《孙子兵法》的作者,後人尊稱為孫子、兵聖、東方兵聖,山東、蘇州等地尚有祀奉孫武的廟宇兵聖廟。其族人为乐安孙氏始祖,次子孙明为富春孙氏始祖。\r\n",
+ "registered": "2014-10-20T10:13:32 -02:00",
+ "latitude": 17.11935,
+ "longitude": 65.38197,
+ "tags": [
+ "new issue",
+ "wontfix"
+ ],
+ "_formatted": {
+ "id": 77,
+ "isActive": false,
+ "balance": "$1,274.29",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "color": "Red",
+ "name": "孙武",
+ "gender": "male",
+ "email": "SunTzu@chorizon.com",
+ "phone": "+1 (810) 407-3258",
+ "address": "吴国",
+ "about": "孫武(前544年-前470年或前496年),字長卿,春秋時期齊國人,著名軍事家、政治家,兵家代表人物。兵書《孙子兵法》的作者,後人尊稱為孫子、兵聖、東方兵聖,山東、蘇州等地尚有祀奉孫武的廟宇兵聖廟。其族人为乐安孙氏始祖,次子孙明为富春孙氏始祖。\r\n",
+ "registered": "2014-10-20T10:13:32 -02:00",
+ "latitude": 17.11935,
+ "longitude": 65.38197,
+ "tags": [
+ "new issue",
+ "wontfix"
+ ]
+ }
+ }
+ ]);
+
+ test_post_get_search!(server, query, |response, _status_code| {
+ assert_json_eq!(expected.clone(), response["hits"].clone(), ordered: false);
+ });
+}
+
#[actix_rt::test]
async fn search_with_attribute_to_highlight_1() {
let mut server = common::Server::test_server().await;