From 23f4e82b53b1d93944a949be2770fe2b6d271cd5 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Mon, 20 Feb 2023 15:43:29 +0100 Subject: [PATCH] Add test ensuring that Meilisearch works on kanji only requests --- meilisearch/tests/search/mod.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/meilisearch/tests/search/mod.rs b/meilisearch/tests/search/mod.rs index 60ffa6cee..91ff64d37 100644 --- a/meilisearch/tests/search/mod.rs +++ b/meilisearch/tests/search/mod.rs @@ -148,6 +148,28 @@ async fn simple_search() { .await; } +#[cfg(feature = "default")] +#[actix_rt::test] +async fn test_kanji_language_detection() { + let server = Server::new().await; + let index = server.index("test"); + + let documents = json!([ + { "id": 0, "title": "The quick (\"brown\") fox can't jump 32.3 feet, right? Brr, it's 29.3°F!" }, + { "id": 1, "title": "東京のお寿司。" }, + { "id": 2, "title": "הַשּׁוּעָל הַמָּהִיר (״הַחוּם״) לֹא יָכוֹל לִקְפֹּץ 9.94 מֶטְרִים, נָכוֹן? ברר, 1.5°C- בַּחוּץ!" } + ]); + index.add_documents(documents, None).await; + index.wait_task(0).await; + + index + .search(json!({"q": "東京"}), |response, code| { + assert_eq!(code, 200, "{}", response); + assert_eq!(response["hits"].as_array().unwrap().len(), 1); + }) + .await; +} + #[actix_rt::test] async fn search_multiple_params() { let server = Server::new().await;