mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-15 15:57:31 +01:00
#4840 - Partial fix - Confirm task success after waiting for it - continued, few missing cases.
This commit is contained in:
parent
bf19f86e38
commit
15062e7dba
@ -427,17 +427,17 @@ macro_rules! compute_forbidden_single_search {
|
||||
let (task,_status_code) = index
|
||||
.update_settings(json!({"filterableAttributes": ["color"]}))
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
drop(index);
|
||||
|
||||
let index = server.index("products");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task,_status_code) = index
|
||||
.update_settings(json!({"filterableAttributes": ["doggos"]}))
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
drop(index);
|
||||
|
||||
assert_eq!($parent_keys.len(), $failed_query_indexes.len(), "keys != query_indexes");
|
||||
@ -499,21 +499,21 @@ macro_rules! compute_forbidden_multiple_search {
|
||||
let index = server.index("sales");
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task,_status_code) = index
|
||||
.update_settings(json!({"filterableAttributes": ["color"]}))
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
drop(index);
|
||||
|
||||
let index = server.index("products");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task,_status_code) = index
|
||||
.update_settings(json!({"filterableAttributes": ["doggos"]}))
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
drop(index);
|
||||
|
||||
assert_eq!($parent_keys.len(), $failed_query_indexes.len(), "keys != query_indexes");
|
||||
|
@ -12,7 +12,7 @@ async fn error_get_unexisting_batch_status() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_coder) = index.create(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (response, code) = index.get_batch(1).await;
|
||||
|
||||
let expected_response = json!({
|
||||
@ -31,7 +31,7 @@ async fn get_batch_status() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task, _status_code) = index.create(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (_response, code) = index.get_batch(0).await;
|
||||
assert_eq!(code, 200);
|
||||
}
|
||||
@ -41,7 +41,7 @@ async fn list_batches() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.create(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
index
|
||||
.add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None)
|
||||
.await;
|
||||
@ -98,7 +98,7 @@ async fn list_batches_with_star_filters() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (batch, _code) = index.create(None).await;
|
||||
index.wait_task(batch.uid()).await;
|
||||
index.wait_task(batch.uid()).await.succeeded();
|
||||
index
|
||||
.add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None)
|
||||
.await;
|
||||
@ -143,7 +143,7 @@ async fn list_batches_status_filtered() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.create(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task,_status_code) = index
|
||||
.add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None)
|
||||
.await;
|
||||
@ -157,7 +157,7 @@ async fn list_batches_status_filtered() {
|
||||
// assert_eq!(code, 200, "{}", response);
|
||||
// assert_eq!(response["results"].as_array().unwrap().len(), 1);
|
||||
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index.filtered_batches(&[], &["succeeded"], &[]).await;
|
||||
assert_eq!(code, 200, "{}", response);
|
||||
@ -169,7 +169,7 @@ async fn list_batches_type_filtered() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.create(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
index
|
||||
.add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None)
|
||||
.await;
|
||||
@ -189,7 +189,7 @@ async fn list_batches_invalid_canceled_by_filter() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.create(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
index
|
||||
.add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None)
|
||||
.await;
|
||||
@ -204,7 +204,7 @@ async fn list_batches_status_and_type_filtered() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.create(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
index
|
||||
.add_documents(serde_json::from_str(include_str!("../assets/test_set.json")).unwrap(), None)
|
||||
.await;
|
||||
|
@ -708,7 +708,7 @@ async fn filter_invalid_attribute_array() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"filterableAttributes": ["title"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": format!("Index `{}`: Attribute `many` is not filterable. Available filterable attributes are: `title`.\n1:5 many = Glass", index.uid),
|
||||
@ -730,7 +730,7 @@ async fn filter_invalid_attribute_string() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"filterableAttributes": ["title"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": format!("Index `{}`: Attribute `many` is not filterable. Available filterable attributes are: `title`.\n1:5 many = Glass", index.uid),
|
||||
@ -752,7 +752,7 @@ async fn filter_reserved_geo_attribute_array() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"filterableAttributes": ["title"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "`_geo` is a reserved keyword and thus can't be used as a filter expression. Use the `_geoRadius(latitude, longitude, distance)` or `_geoBoundingBox([latitude, longitude], [latitude, longitude])` built-in rules to filter on `_geo` coordinates.\n1:13 _geo = Glass",
|
||||
@ -774,7 +774,7 @@ async fn filter_reserved_geo_attribute_string() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"filterableAttributes": ["title"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "`_geo` is a reserved keyword and thus can't be used as a filter expression. Use the `_geoRadius(latitude, longitude, distance)` or `_geoBoundingBox([latitude, longitude], [latitude, longitude])` built-in rules to filter on `_geo` coordinates.\n1:13 _geo = Glass",
|
||||
@ -796,7 +796,7 @@ async fn filter_reserved_attribute_array() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"filterableAttributes": ["title"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "`_geoDistance` is a reserved keyword and thus can't be used as a filter expression. Use the `_geoRadius(latitude, longitude, distance)` or `_geoBoundingBox([latitude, longitude], [latitude, longitude])` built-in rules to filter on `_geo` coordinates.\n1:21 _geoDistance = Glass",
|
||||
@ -818,7 +818,7 @@ async fn filter_reserved_attribute_string() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"filterableAttributes": ["title"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "`_geoDistance` is a reserved keyword and thus can't be used as a filter expression. Use the `_geoRadius(latitude, longitude, distance)` or `_geoBoundingBox([latitude, longitude], [latitude, longitude])` built-in rules to filter on `_geo` coordinates.\n1:21 _geoDistance = Glass",
|
||||
@ -840,7 +840,7 @@ async fn filter_reserved_geo_point_array() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"filterableAttributes": ["title"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "`_geoPoint` is a reserved keyword and thus can't be used as a filter expression. Use the `_geoRadius(latitude, longitude, distance)` or `_geoBoundingBox([latitude, longitude], [latitude, longitude])` built-in rules to filter on `_geo` coordinates.\n1:18 _geoPoint = Glass",
|
||||
|
@ -281,7 +281,7 @@ async fn facet_search_dont_support_words() {
|
||||
let documents = DOCUMENTS.clone();
|
||||
index.update_settings_filterable_attributes(json!(["genres"])).await;
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) =
|
||||
index.facet_search(json!({"facetName": "genres", "facetQuery": "words"})).await;
|
||||
@ -299,7 +299,7 @@ async fn simple_facet_search_with_sort_by_count() {
|
||||
index.update_settings_faceting(json!({ "sortFacetValuesBy": { "*": "count" } })).await;
|
||||
index.update_settings_filterable_attributes(json!(["genres"])).await;
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) =
|
||||
index.facet_search(json!({"facetName": "genres", "facetQuery": "a"})).await;
|
||||
|
@ -596,7 +596,7 @@ async fn test_cjk_highlight() {
|
||||
{ "id": 1, "title": "大卫到了扫罗那里" },
|
||||
]);
|
||||
let (response, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(json!({"q": "で", "attributesToHighlight": ["title"]}), |response, code| {
|
||||
|
@ -573,7 +573,7 @@ async fn retrieve_vectors() {
|
||||
.update_settings(json!({ "displayedAttributes": ["id", "title", "desc", "_vectors"]} ))
|
||||
.await;
|
||||
assert_eq!(202, code, "{:?}", response);
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index
|
||||
.search_post(
|
||||
@ -623,7 +623,7 @@ async fn retrieve_vectors() {
|
||||
let (response, code) =
|
||||
index.update_settings(json!({ "displayedAttributes": ["id", "title", "desc"]} )).await;
|
||||
assert_eq!(202, code, "{:?}", response);
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index
|
||||
.search_post(
|
||||
|
@ -528,7 +528,7 @@ async fn auto_infer_locales_at_search_with_attributes_to_search_on() {
|
||||
}
|
||||
"###);
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
// auto infer any language
|
||||
index
|
||||
@ -602,7 +602,7 @@ async fn auto_infer_locales_at_search() {
|
||||
}
|
||||
"###);
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -701,7 +701,7 @@ async fn force_different_locales_with_pattern_nested() {
|
||||
}
|
||||
"###);
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
// chinese
|
||||
index
|
||||
@ -779,7 +779,7 @@ async fn settings_change() {
|
||||
let index = server.index("test");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (response, _) = index
|
||||
.update_settings(json!({
|
||||
"searchableAttributes": ["document_en", "document_ja", "document_zh"],
|
||||
@ -798,7 +798,7 @@ async fn settings_change() {
|
||||
"enqueuedAt": "[date]"
|
||||
}
|
||||
"###);
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
// chinese
|
||||
index
|
||||
@ -861,7 +861,7 @@ async fn settings_change() {
|
||||
"enqueuedAt": "[date]"
|
||||
}
|
||||
"###);
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
// chinese
|
||||
index
|
||||
@ -916,7 +916,7 @@ async fn invalid_locales() {
|
||||
)
|
||||
.await;
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index.search_post(json!({"q": "Atta", "locales": ["invalid"]})).await;
|
||||
snapshot!(code, @"400 Bad Request");
|
||||
@ -1034,7 +1034,7 @@ async fn simple_facet_search() {
|
||||
}
|
||||
"###);
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index
|
||||
.facet_search(json!({"facetName": "name_zh", "facetQuery": "進撃", "locales": ["cmn"]}))
|
||||
|
@ -248,7 +248,7 @@ async fn test_kanji_language_detection() {
|
||||
{ "id": 2, "title": "הַשּׁוּעָל הַמָּהִיר (״הַחוּם״) לֹא יָכוֹל לִקְפֹּץ 9.94 מֶטְרִים, נָכוֹן? ברר, 1.5°C- בַּחוּץ!" }
|
||||
]);
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(json!({"q": "東京"}), |response, code| {
|
||||
@ -271,10 +271,10 @@ async fn test_thai_language() {
|
||||
{ "id": 2, "title": "สบู่สมุนไพรฝางแดงผสมว่านหางจรเข้ 100 กรัม จำนวน 6 ก้อน" }
|
||||
]);
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (task,_status_code) = index.update_settings(json!({"rankingRules": ["exactness"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(json!({"q": "สบู"}), |response, code| {
|
||||
@ -608,7 +608,7 @@ async fn displayed_attributes() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) =
|
||||
index.search_post(json!({ "attributesToRetrieve": ["title", "id"] })).await;
|
||||
|
@ -564,7 +564,7 @@ async fn federation_two_search_two_indexes() {
|
||||
let index = server.index("nested");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -667,17 +667,17 @@ async fn federation_multiple_search_multiple_indexes() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("nested");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("score");
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -925,7 +925,7 @@ async fn search_one_index_doesnt_exist() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"queries": [
|
||||
@ -951,7 +951,7 @@ async fn federation_one_index_doesnt_exist() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -1022,12 +1022,12 @@ async fn search_one_query_error() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("nested");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"queries": [
|
||||
@ -1054,12 +1054,12 @@ async fn federation_one_query_error() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("nested");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -1086,12 +1086,12 @@ async fn federation_one_query_sort_error() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("nested");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -1118,12 +1118,12 @@ async fn search_multiple_query_errors() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("nested");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"queries": [
|
||||
@ -1150,12 +1150,12 @@ async fn federation_multiple_query_errors() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("nested");
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"queries": [
|
||||
|
@ -7,7 +7,7 @@ async fn set_and_reset_distinct_attribute() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (task1, _code) = index.update_settings(json!({ "distinctAttribute": "test"})).await;
|
||||
index.wait_task(task1.uid()).await;
|
||||
index.wait_task(task1.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index.settings().await;
|
||||
|
||||
@ -15,7 +15,7 @@ async fn set_and_reset_distinct_attribute() {
|
||||
|
||||
let (task2,_status_code) = index.update_settings(json!({ "distinctAttribute": null })).await;
|
||||
|
||||
index.wait_task(task2.uid()).await;
|
||||
index.wait_task(task2.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index.settings().await;
|
||||
|
||||
@ -28,7 +28,7 @@ async fn set_and_reset_distinct_attribute_with_dedicated_route() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (update_task1, _code) = index.update_distinct_attribute(json!("test")).await;
|
||||
index.wait_task(update_task1.uid()).await;
|
||||
index.wait_task(update_task1.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index.get_distinct_attribute().await;
|
||||
|
||||
@ -36,7 +36,7 @@ async fn set_and_reset_distinct_attribute_with_dedicated_route() {
|
||||
|
||||
let (update_task2,_status_code) = index.update_distinct_attribute(json!(null)).await;
|
||||
|
||||
index.wait_task(update_task2.uid()).await;
|
||||
index.wait_task(update_task2.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index.get_distinct_attribute().await;
|
||||
|
||||
|
@ -193,7 +193,7 @@ async fn get_settings() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (response, _code) = index.create(None).await;
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
let (response, code) = index.settings().await;
|
||||
assert_eq!(code, 200);
|
||||
let settings = response.as_object().unwrap();
|
||||
|
@ -30,7 +30,7 @@ async fn attribute_scale_search() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (task,_status_code) = index.add_documents(DOCUMENTS.clone(), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index
|
||||
.update_settings(json!({
|
||||
@ -39,7 +39,7 @@ async fn attribute_scale_search() {
|
||||
}))
|
||||
.await;
|
||||
assert_eq!("202", code.as_str(), "{:?}", response);
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
// the expected order is [1, 3, 2] instead of [3, 1, 2]
|
||||
// because the attribute scale doesn't make the difference between 1 and 3.
|
||||
@ -103,7 +103,7 @@ async fn attribute_scale_phrase_search() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (task,_status_code) = index.add_documents(DOCUMENTS.clone(), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (task, _code) = index
|
||||
.update_settings(json!({
|
||||
@ -111,7 +111,7 @@ async fn attribute_scale_phrase_search() {
|
||||
"rankingRules": ["words", "typo", "proximity"],
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
// the expected order is [1, 3] instead of [3, 1]
|
||||
// because the attribute scale doesn't make the difference between 1 and 3.
|
||||
@ -171,7 +171,7 @@ async fn word_scale_set_and_reset() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (task,_status_code) = index.add_documents(DOCUMENTS.clone(), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
// Set and reset the setting ensuring the swap between the 2 settings is applied.
|
||||
let (update_task1, _code) = index
|
||||
@ -180,7 +180,7 @@ async fn word_scale_set_and_reset() {
|
||||
"rankingRules": ["words", "typo", "proximity"],
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(update_task1.uid()).await;
|
||||
index.wait_task(update_task1.uid()).await.succeeded();
|
||||
|
||||
let (update_task2, _code) = index
|
||||
.update_settings(json!({
|
||||
@ -188,7 +188,7 @@ async fn word_scale_set_and_reset() {
|
||||
"rankingRules": ["words", "typo", "proximity"],
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(update_task2.uid()).await;
|
||||
index.wait_task(update_task2.uid()).await.succeeded();
|
||||
|
||||
// [3, 1, 2]
|
||||
index
|
||||
@ -286,7 +286,7 @@ async fn attribute_scale_default_ranking_rules() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (task,_status_code) = index.add_documents(DOCUMENTS.clone(), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index
|
||||
.update_settings(json!({
|
||||
@ -294,7 +294,7 @@ async fn attribute_scale_default_ranking_rules() {
|
||||
}))
|
||||
.await;
|
||||
assert_eq!("202", code.as_str(), "{:?}", response);
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
// the expected order is [3, 1, 2]
|
||||
index
|
||||
|
@ -16,7 +16,7 @@ async fn set_and_reset() {
|
||||
"dictionary": ["J.R.R.", "J. R. R."],
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index.settings().await;
|
||||
snapshot!(json_string!(response["nonSeparatorTokens"]), @r###"
|
||||
@ -46,7 +46,7 @@ async fn set_and_reset() {
|
||||
}))
|
||||
.await;
|
||||
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index.settings().await;
|
||||
snapshot!(json_string!(response["nonSeparatorTokens"]), @"[]");
|
||||
@ -75,7 +75,7 @@ async fn set_and_search() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (add_task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(add_task.uid()).await;
|
||||
index.wait_task(add_task.uid()).await.succeeded();
|
||||
|
||||
let (update_task, _code) = index
|
||||
.update_settings(json!({
|
||||
@ -84,7 +84,7 @@ async fn set_and_search() {
|
||||
"dictionary": ["#", "A#", "B#", "C#", "D#", "E#", "F#", "G#"],
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(update_task.uid()).await;
|
||||
index.wait_task(update_task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(json!({"q": "&", "attributesToHighlight": ["content"]}), |response, code| {
|
||||
@ -229,7 +229,7 @@ async fn advanced_synergies() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (add_task,_status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(add_task.uid()).await;
|
||||
index.wait_task(add_task.uid()).await.succeeded();
|
||||
|
||||
let (update_task, _code) = index
|
||||
.update_settings(json!({
|
||||
|
@ -77,7 +77,7 @@ async fn basic() {
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, code) = index.add_documents(documents, None).await;
|
||||
snapshot!(code, @"202 Accepted");
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.similar(
|
||||
@ -274,7 +274,7 @@ async fn ranking_score_threshold() {
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, code) = index.add_documents(documents, None).await;
|
||||
snapshot!(code, @"202 Accepted");
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.similar(
|
||||
@ -555,7 +555,7 @@ async fn filter() {
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, code) = index.add_documents(documents, None).await;
|
||||
snapshot!(code, @"202 Accepted");
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.similar(
|
||||
|
@ -304,7 +304,7 @@ async fn test_summarized_document_addition_or_update() {
|
||||
"###);
|
||||
|
||||
let (task,_status_code) = index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), Some("id")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(1).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -334,7 +334,7 @@ async fn test_summarized_delete_documents_by_batch() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.delete_batch(vec![1, 2, 3]).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(0).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -366,7 +366,7 @@ async fn test_summarized_delete_documents_by_batch() {
|
||||
|
||||
index.create(None).await;
|
||||
let (del_task,_status_code) = index.delete_batch(vec![42]).await;
|
||||
index.wait_task(del_task.uid()).await;
|
||||
index.wait_task(del_task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(del_task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -398,7 +398,7 @@ async fn test_summarized_delete_documents_by_filter() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -430,7 +430,7 @@ async fn test_summarized_delete_documents_by_filter() {
|
||||
|
||||
index.create(None).await;
|
||||
let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -462,7 +462,7 @@ async fn test_summarized_delete_documents_by_filter() {
|
||||
|
||||
index.update_settings(json!({ "filterableAttributes": ["doggo"] })).await;
|
||||
let (task,_status_code) = index.delete_document_by_filter(json!({ "filter": "doggo = bernese" })).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -493,7 +493,7 @@ async fn test_summarized_delete_document_by_id() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.delete_document(1).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -525,7 +525,7 @@ async fn test_summarized_delete_document_by_id() {
|
||||
|
||||
index.create(None).await;
|
||||
let (task,_status_code) = index.delete_document(42).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -568,7 +568,7 @@ async fn test_summarized_settings_update() {
|
||||
"###);
|
||||
|
||||
let (task,_status_code) = index.update_settings(json!({ "displayedAttributes": ["doggos", "name"], "filterableAttributes": ["age", "nb_paw_pads"], "sortableAttributes": ["iq"] })).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = index.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
|
@ -63,7 +63,7 @@ async fn add_remove_user_provided() {
|
||||
]);
|
||||
let (value, code) = index.add_documents(documents, None).await;
|
||||
snapshot!(code, @"202 Accepted");
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (documents, _code) = index
|
||||
.get_all_documents(GetAllDocumentsOptions { retrieve_vectors: true, ..Default::default() })
|
||||
@ -116,7 +116,7 @@ async fn add_remove_user_provided() {
|
||||
]);
|
||||
let (value, code) = index.add_documents(documents, None).await;
|
||||
snapshot!(code, @"202 Accepted");
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (documents, _code) = index
|
||||
.get_all_documents(GetAllDocumentsOptions { retrieve_vectors: true, ..Default::default() })
|
||||
@ -159,7 +159,7 @@ async fn add_remove_user_provided() {
|
||||
|
||||
let (value, code) = index.delete_document(0).await;
|
||||
snapshot!(code, @"202 Accepted");
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (documents, _code) = index
|
||||
.get_all_documents(GetAllDocumentsOptions { retrieve_vectors: true, ..Default::default() })
|
||||
@ -221,7 +221,7 @@ async fn generate_default_user_provided_documents(server: &Server) -> Index {
|
||||
]);
|
||||
let (value, code) = index.add_documents(documents, None).await;
|
||||
snapshot!(code, @"202 Accepted");
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user