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 - batch 2
This commit is contained in:
parent
15062e7dba
commit
d7cb319217
@ -278,7 +278,7 @@ async fn test_summarized_document_addition_or_update() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.add_documents(json!({ "id": 42, "content": "doggos & fluff" }), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (batch, _) = index.get_batch(0).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -309,7 +309,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 (batch, _) = index.get_batch(1).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -345,7 +345,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 (batch, _) = index.get_batch(0).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -377,7 +377,7 @@ async fn test_summarized_delete_documents_by_batch() {
|
||||
|
||||
index.create(None).await;
|
||||
let (task,_status_code) = index.delete_batch(vec![42]).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (batch, _) = index.get_batch(2).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -414,7 +414,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 (batch, _) = index.get_batch(0).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -447,7 +447,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 (batch, _) = index.get_batch(2).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -480,7 +480,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 (batch, _) = index.get_batch(4).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -517,7 +517,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 (batch, _) = index.get_batch(0).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -549,7 +549,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 (batch, _) = index.get_batch(2).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -597,7 +597,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 (batch, _) = index.get_batch(0).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -642,7 +642,7 @@ async fn test_summarized_index_creation() {
|
||||
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 (batch, _) = index.get_batch(0).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -670,7 +670,7 @@ async fn test_summarized_index_creation() {
|
||||
"#);
|
||||
|
||||
let (task,_status_code) = index.create(Some("doggos")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (batch, _) = index.get_batch(1).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -815,7 +815,7 @@ async fn test_summarized_index_update() {
|
||||
let index = server.index("test");
|
||||
// If the index doesn't exist yet, we should get errors with or without the primary key.
|
||||
let (task,_status_code) = index.update(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (batch, _) = index.get_batch(0).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -843,7 +843,7 @@ async fn test_summarized_index_update() {
|
||||
"#);
|
||||
|
||||
let (task,_status_code) = index.update(Some("bones")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (batch, _) = index.get_batch(1).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -876,7 +876,7 @@ async fn test_summarized_index_update() {
|
||||
index.create(None).await;
|
||||
|
||||
let (task,_status_code) = index.update(None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (batch, _) = index.get_batch(3).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -904,7 +904,7 @@ async fn test_summarized_index_update() {
|
||||
"#);
|
||||
|
||||
let (task,_status_code) = index.update(Some("bones")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (batch, _) = index.get_batch(4).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -1024,9 +1024,9 @@ async fn test_summarized_batch_cancelation() {
|
||||
let index = server.index("doggos");
|
||||
// to avoid being flaky we're only going to cancel an already finished batch :(
|
||||
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) = server.cancel_tasks("uids=0").await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
//TODO: create a get_batch function interface that accepts u64, and remove the following cast.
|
||||
let (batch, _) = index.get_batch(task.uid().to_u32().unwrap()).await;
|
||||
assert_json_snapshot!(batch,
|
||||
@ -1063,9 +1063,9 @@ async fn test_summarized_batch_deletion() {
|
||||
let index = server.index("doggos");
|
||||
// to avoid being flaky we're only going to delete an already finished batch :(
|
||||
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) = server.delete_tasks("uids=0").await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (batch, _) = index.get_batch(1).await;
|
||||
assert_json_snapshot!(batch,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
|
@ -981,7 +981,7 @@ async fn add_documents_no_index_creation() {
|
||||
snapshot!(code, @"202 Accepted");
|
||||
assert_eq!(response["taskUid"], 0);
|
||||
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index.get_task(0).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
@ -1060,7 +1060,7 @@ async fn document_addition_with_primary_key() {
|
||||
}
|
||||
"###);
|
||||
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index.get_task(response.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
@ -1170,7 +1170,7 @@ async fn replace_document() {
|
||||
}
|
||||
"###);
|
||||
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
let documents = json!([
|
||||
{
|
||||
@ -1182,7 +1182,7 @@ async fn replace_document() {
|
||||
let (task, code) = index.add_documents(documents, None).await;
|
||||
snapshot!(code,@"202 Accepted");
|
||||
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
@ -1275,7 +1275,7 @@ async fn error_add_documents_bad_document_id() {
|
||||
}
|
||||
]);
|
||||
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.get_task(1).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -1391,7 +1391,7 @@ async fn error_add_documents_missing_document_id() {
|
||||
}
|
||||
]);
|
||||
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.get_task(1).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -1742,7 +1742,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(2).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -1780,7 +1780,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(3).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -1818,7 +1818,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(4).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -1856,7 +1856,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -1894,7 +1894,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -1932,7 +1932,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -1970,7 +1970,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -2008,7 +2008,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -2046,7 +2046,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -2084,7 +2084,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -2122,7 +2122,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -2160,7 +2160,7 @@ async fn add_documents_invalid_geo_field() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
snapshot!(json_string!(response, { ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" }),
|
||||
@ -2410,7 +2410,7 @@ async fn error_primary_key_inference() {
|
||||
]);
|
||||
|
||||
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.get_task(0).await;
|
||||
assert_eq!(code, 200);
|
||||
|
||||
@ -2451,7 +2451,7 @@ async fn error_primary_key_inference() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
assert_eq!(code, 200);
|
||||
|
||||
@ -2490,7 +2490,7 @@ async fn error_primary_key_inference() {
|
||||
]);
|
||||
|
||||
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.get_task(task.uid()).await;
|
||||
assert_eq!(code, 200);
|
||||
|
||||
@ -2529,12 +2529,12 @@ async fn add_documents_with_primary_key_twice() {
|
||||
]);
|
||||
|
||||
let (task,_status_code) = index.add_documents(documents.clone(), Some("title")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (response, _code) = index.get_task(task.uid()).await;
|
||||
assert_eq!(response["status"], "succeeded");
|
||||
|
||||
let (task,_status_code) = index.add_documents(documents, Some("title")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (response, _code) = index.get_task(task.uid()).await;
|
||||
assert_eq!(response["status"], "succeeded");
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ async fn delete_one_document() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.add_documents(json!([{ "id": 0, "content": "foobar" }]), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task,status_code) = server.index("test").delete_document(0).await;
|
||||
assert_eq!(status_code, 202);
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (_response, code) = index.get_document(0, None).await;
|
||||
assert_eq!(code, 404);
|
||||
@ -62,7 +62,7 @@ async fn clear_all_documents() {
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, code) = index.clear_all_documents().await;
|
||||
assert_eq!(code, 202);
|
||||
|
||||
@ -77,13 +77,13 @@ async fn clear_all_documents_empty_index() {
|
||||
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, code) = index.clear_all_documents().await;
|
||||
assert_eq!(code, 202);
|
||||
|
||||
let _update = index.wait_task(task.uid()).await;
|
||||
let (response, code) = index.get_all_documents(GetAllDocumentsOptions::default()).await;
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
assert_eq!(code, 200);
|
||||
assert!(response["results"].as_array().unwrap().is_empty());
|
||||
}
|
||||
@ -112,7 +112,7 @@ async fn delete_batch() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.add_documents(json!([{ "id": 1, "content": "foobar" }, { "id": 0, "content": "foobar" }, { "id": 3, "content": "foobar" }]), Some("id")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (task, code) = index.delete_batch(vec![1, 0]).await;
|
||||
assert_eq!(code, 202);
|
||||
|
||||
@ -128,7 +128,7 @@ async fn delete_no_document_batch() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task,_status_code) = index.add_documents(json!([{ "id": 1, "content": "foobar" }, { "id": 0, "content": "foobar" }, { "id": 3, "content": "foobar" }]), Some("id")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (_response, code) = index.delete_batch(vec![]).await;
|
||||
assert_eq!(code, 202, "{}", _response);
|
||||
|
||||
@ -154,7 +154,7 @@ async fn delete_document_by_filter() {
|
||||
Some("id"),
|
||||
)
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (stats, _) = index.stats().await;
|
||||
snapshot!(json_string!(stats), @r###"
|
||||
@ -315,7 +315,7 @@ async fn delete_document_by_complex_filter() {
|
||||
Some("id"),
|
||||
)
|
||||
.await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (response, code) = index
|
||||
.delete_document_by_filter(
|
||||
json!({ "filter": ["color != red", "color != green", "color EXISTS"] }),
|
||||
|
@ -862,7 +862,7 @@ async fn filter_reserved_geo_point_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": "`_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",
|
||||
@ -884,7 +884,7 @@ async fn sort_geo_reserved_attribute() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"sortableAttributes": ["id"]})).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 sort expression. Use the _geoPoint(latitude, longitude) built-in rule to sort on _geo field coordinates.",
|
||||
@ -911,7 +911,7 @@ async fn sort_reserved_attribute() {
|
||||
let index = server.unique_index();
|
||||
|
||||
let (task, _code) = index.update_settings(json!({"sortableAttributes": ["id"]})).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 sort expression.",
|
||||
@ -1095,7 +1095,7 @@ async fn distinct_at_search_time() {
|
||||
assert_eq!(code, 400);
|
||||
|
||||
let (task, _) = index.update_settings_filterable_attributes(json!(["color", "machin"])).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": format!("Index `{}`: Attribute `doggo.truc` is not filterable and thus, cannot be used as distinct attribute. Available filterable attributes are: `color, machin`.", index.uid),
|
||||
@ -1109,7 +1109,7 @@ async fn distinct_at_search_time() {
|
||||
assert_eq!(code, 400);
|
||||
|
||||
let (task, _) = index.update_settings_displayed_attributes(json!(["color"])).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": format!("Index `{}`: Attribute `doggo.truc` is not filterable and thus, cannot be used as distinct attribute. Available filterable attributes are: `color, <..hidden-attributes>`.", index.uid),
|
||||
|
@ -1096,7 +1096,7 @@ async fn facet_search_with_localized_attributes() {
|
||||
}
|
||||
"###);
|
||||
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"]}))
|
||||
@ -1165,7 +1165,7 @@ async fn swedish_search() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(_response.uid()).await;
|
||||
index.wait_task(_response.uid()).await.succeeded();
|
||||
|
||||
// infer swedish
|
||||
index
|
||||
@ -1286,7 +1286,7 @@ async fn german_search() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(_response.uid()).await;
|
||||
index.wait_task(_response.uid()).await.succeeded();
|
||||
|
||||
// infer swedish
|
||||
index
|
||||
|
@ -623,7 +623,7 @@ async fn placeholder_search_is_hard_limited() {
|
||||
|
||||
let documents: Vec<_> = (0..1200).map(|i| json!({ "id": i, "text": "I am unique!" })).collect();
|
||||
let (task,_status_code) = index.add_documents(documents.into(), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -651,7 +651,7 @@ async fn placeholder_search_is_hard_limited() {
|
||||
.await;
|
||||
|
||||
let (task,_status_code) = index.update_settings(json!({ "pagination": { "maxTotalHits": 10_000 } })).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -686,7 +686,7 @@ async fn search_is_hard_limited() {
|
||||
|
||||
let documents: Vec<_> = (0..1200).map(|i| json!({ "id": i, "text": "I am unique!" })).collect();
|
||||
let (task,_status_code) = index.add_documents(documents.into(), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -716,7 +716,7 @@ async fn search_is_hard_limited() {
|
||||
.await;
|
||||
|
||||
let (task,_status_code) = index.update_settings(json!({ "pagination": { "maxTotalHits": 10_000 } })).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -755,7 +755,7 @@ async fn faceting_max_values_per_facet() {
|
||||
|
||||
let documents: Vec<_> = (0..10_000).map(|id| json!({ "id": id, "number": id * 10 })).collect();
|
||||
let (task,_status_code) = index.add_documents(json!(documents), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -771,7 +771,7 @@ async fn faceting_max_values_per_facet() {
|
||||
.await;
|
||||
|
||||
let (task,_status_code) = index.update_settings(json!({ "faceting": { "maxValuesPerFacet": 10_000 } })).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -795,7 +795,7 @@ async fn test_score_details() {
|
||||
let documents = DOCUMENTS.clone();
|
||||
|
||||
let res = index.add_documents(json!(documents), None).await;
|
||||
index.wait_task(res.0.uid()).await;
|
||||
index.wait_task(res.0.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -868,7 +868,7 @@ async fn test_score() {
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
|
||||
let res = index.add_documents(json!(documents), None).await;
|
||||
index.wait_task(res.0.uid()).await;
|
||||
index.wait_task(res.0.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -921,7 +921,7 @@ async fn test_score_threshold() {
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
|
||||
let res = index.add_documents(json!(documents), None).await;
|
||||
index.wait_task(res.0.uid()).await;
|
||||
index.wait_task(res.0.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -1077,7 +1077,7 @@ async fn test_degraded_score_details() {
|
||||
index.add_documents(json!(documents), None).await;
|
||||
// We can't really use anything else than 0ms here; otherwise, the test will get flaky.
|
||||
let (res, _code) = index.update_settings(json!({ "searchCutoffMs": 0 })).await;
|
||||
index.wait_task(res.uid()).await;
|
||||
index.wait_task(res.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(
|
||||
@ -1163,7 +1163,7 @@ async fn experimental_feature_vector_store() {
|
||||
let documents = DOCUMENTS.clone();
|
||||
|
||||
let (task,_status_code) = index.add_documents(json!(documents), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index
|
||||
.search_post(json!({
|
||||
@ -1370,7 +1370,7 @@ async fn camelcased_words() {
|
||||
{ "id": 4, "title": "testab" },
|
||||
]);
|
||||
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": "deLonghi"}), |response, code| {
|
||||
@ -1593,7 +1593,7 @@ async fn simple_search_with_strange_synonyms() {
|
||||
|
||||
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();
|
||||
|
||||
index
|
||||
.search(json!({"q": "How to train"}), |response, code| {
|
||||
@ -1680,11 +1680,11 @@ async fn change_attributes_settings() {
|
||||
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (task,_status_code) = index.add_documents(json!(documents), None).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (task,_status_code) =
|
||||
index.update_settings(json!({ "searchableAttributes": ["father", "mother", "doggos"], "filterableAttributes": ["doggos"] })).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
// search
|
||||
index
|
||||
|
@ -1182,12 +1182,12 @@ async fn federation_multiple_query_sort_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": [
|
||||
@ -1214,12 +1214,12 @@ async fn federation_multiple_query_errors_interleaved() {
|
||||
|
||||
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": [
|
||||
@ -1247,12 +1247,12 @@ async fn federation_multiple_query_sort_errors_interleaved() {
|
||||
|
||||
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": [
|
||||
@ -1280,14 +1280,14 @@ async fn federation_filter() {
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(
|
||||
json!({"searchableAttributes": ["name"], "filterableAttributes": ["BOOST"]}),
|
||||
)
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -1348,7 +1348,7 @@ async fn federation_sort_same_indexes_same_criterion_same_direction() {
|
||||
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -1363,7 +1363,7 @@ async fn federation_sort_same_indexes_same_criterion_same_direction() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// two identical placeholder search should have all results from first query
|
||||
let (response, code) = server
|
||||
@ -1611,7 +1611,7 @@ async fn federation_sort_same_indexes_same_criterion_opposite_direction() {
|
||||
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -1626,7 +1626,7 @@ async fn federation_sort_same_indexes_same_criterion_opposite_direction() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// two identical placeholder search should have all results from first query
|
||||
let (response, code) = server
|
||||
@ -1671,7 +1671,7 @@ async fn federation_sort_same_indexes_different_criterion_same_direction() {
|
||||
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -1686,7 +1686,7 @@ async fn federation_sort_same_indexes_different_criterion_same_direction() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// return mothers and fathers ordered accross fields.
|
||||
let (response, code) = server
|
||||
@ -1935,7 +1935,7 @@ async fn federation_sort_same_indexes_different_criterion_opposite_direction() {
|
||||
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -1950,7 +1950,7 @@ async fn federation_sort_same_indexes_different_criterion_opposite_direction() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// two identical placeholder search should have all results from first query
|
||||
let (response, code) = server
|
||||
@ -1995,7 +1995,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2010,13 +2010,13 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("batman");
|
||||
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2031,7 +2031,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// return titles ordered accross indexes
|
||||
let (response, code) = server
|
||||
@ -2307,7 +2307,7 @@ async fn federation_sort_different_ranking_rules() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2322,13 +2322,13 @@ async fn federation_sort_different_ranking_rules() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("batman");
|
||||
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2343,7 +2343,7 @@ async fn federation_sort_different_ranking_rules() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// return titles ordered accross indexes
|
||||
let (response, code) = server
|
||||
@ -2546,7 +2546,7 @@ async fn federation_sort_different_indexes_same_criterion_opposite_direction() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2561,13 +2561,13 @@ async fn federation_sort_different_indexes_same_criterion_opposite_direction() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("batman");
|
||||
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2582,7 +2582,7 @@ async fn federation_sort_different_indexes_same_criterion_opposite_direction() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// all results from query 0
|
||||
let (response, code) = server
|
||||
@ -2628,7 +2628,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction()
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2643,13 +2643,13 @@ async fn federation_sort_different_indexes_different_criterion_same_direction()
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("batman");
|
||||
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2664,7 +2664,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction()
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// return titles ordered accross indexes
|
||||
let (response, code) = server
|
||||
@ -2940,7 +2940,7 @@ async fn federation_sort_different_indexes_different_criterion_opposite_directio
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2955,13 +2955,13 @@ async fn federation_sort_different_indexes_different_criterion_opposite_directio
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("batman");
|
||||
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -2976,7 +2976,7 @@ async fn federation_sort_different_indexes_different_criterion_opposite_directio
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// all results from query 0 first
|
||||
let (response, code) = server
|
||||
@ -3021,17 +3021,17 @@ async fn federation_limit_offset() {
|
||||
|
||||
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": [
|
||||
@ -3339,17 +3339,17 @@ async fn federation_formatting() {
|
||||
|
||||
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": [
|
||||
@ -3685,14 +3685,14 @@ async fn federation_invalid_weight() {
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(
|
||||
json!({"searchableAttributes": ["name"], "filterableAttributes": ["BOOST"]}),
|
||||
)
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -3719,14 +3719,14 @@ async fn federation_null_weight() {
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(
|
||||
json!({"searchableAttributes": ["name"], "filterableAttributes": ["BOOST"]}),
|
||||
)
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -3787,7 +3787,7 @@ async fn federation_federated_contains_pagination() {
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// fail when a federated query contains "limit"
|
||||
let (response, code) = server
|
||||
@ -3867,11 +3867,11 @@ async fn federation_federated_contains_facets() {
|
||||
)
|
||||
.await;
|
||||
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// empty facets are actually OK
|
||||
let (response, code) = server
|
||||
@ -3951,7 +3951,7 @@ async fn federation_non_faceted_for_an_index() {
|
||||
)
|
||||
.await;
|
||||
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("fruits-no-name");
|
||||
|
||||
@ -3961,17 +3961,17 @@ async fn federation_non_faceted_for_an_index() {
|
||||
)
|
||||
.await;
|
||||
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("fruits-no-facets");
|
||||
|
||||
let (value, _) = index.update_settings(json!({"searchableAttributes": ["name"]})).await;
|
||||
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// fails
|
||||
let (response, code) = server
|
||||
@ -4071,7 +4071,7 @@ async fn federation_non_federated_contains_federation_option() {
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// fail when a non-federated query contains "federationOptions"
|
||||
let (response, code) = server
|
||||
@ -4116,12 +4116,12 @@ async fn federation_vector_single_index() {
|
||||
}
|
||||
}}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let documents = VECTOR_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();
|
||||
|
||||
// same embedder
|
||||
let (response, code) = server
|
||||
@ -4320,12 +4320,12 @@ async fn federation_vector_two_indexes() {
|
||||
},
|
||||
}}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let documents = VECTOR_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();
|
||||
|
||||
let index = server.index("vectors-sentiment");
|
||||
|
||||
@ -4337,12 +4337,12 @@ async fn federation_vector_two_indexes() {
|
||||
}
|
||||
}}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let documents = VECTOR_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();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {}, "queries": [
|
||||
@ -4802,7 +4802,7 @@ async fn federation_facets_different_indexes_same_facet() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -4818,13 +4818,13 @@ async fn federation_facets_different_indexes_same_facet() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("batman");
|
||||
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -4840,13 +4840,13 @@ async fn federation_facets_different_indexes_same_facet() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("batman-2");
|
||||
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -4862,7 +4862,7 @@ async fn federation_facets_different_indexes_same_facet() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// return titles ordered accross indexes
|
||||
let (response, code) = server
|
||||
@ -5369,7 +5369,7 @@ async fn federation_facets_same_indexes() {
|
||||
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -5384,13 +5384,13 @@ async fn federation_facets_same_indexes() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("doggos-2");
|
||||
|
||||
let documents = NESTED_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -5405,7 +5405,7 @@ async fn federation_facets_same_indexes() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = server
|
||||
.multi_search(json!({"federation": {
|
||||
@ -5670,7 +5670,7 @@ async fn federation_inconsistent_merge_order() {
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -5686,13 +5686,13 @@ async fn federation_inconsistent_merge_order() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("movies-2");
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -5711,13 +5711,13 @@ async fn federation_inconsistent_merge_order() {
|
||||
}
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("batman");
|
||||
|
||||
let documents = SCORE_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(json!({
|
||||
@ -5733,7 +5733,7 @@ async fn federation_inconsistent_merge_order() {
|
||||
]
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// without merging, it works
|
||||
let (response, code) = server
|
||||
|
@ -250,7 +250,7 @@ async fn secrets_are_hidden_in_settings() {
|
||||
|
||||
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
|
||||
.update_settings(json!({
|
||||
@ -379,14 +379,14 @@ async fn test_partial_update() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (task, _code) = index.update_settings(json!({"displayedAttributes": ["foo"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
let (response, code) = index.settings().await;
|
||||
assert_eq!(code, 200);
|
||||
assert_eq!(response["displayedAttributes"], json!(["foo"]));
|
||||
assert_eq!(response["searchableAttributes"], json!(["*"]));
|
||||
|
||||
let (task, _) = index.update_settings(json!({"searchableAttributes": ["bar"]})).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index.settings().await;
|
||||
assert_eq!(code, 200);
|
||||
@ -422,12 +422,12 @@ async fn reset_all_settings() {
|
||||
let (response, code) = index.add_documents(documents, None).await;
|
||||
assert_eq!(code, 202);
|
||||
assert_eq!(response["taskUid"], 0);
|
||||
index.wait_task(response.uid()).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
||||
let (update_task,_status_code) = index
|
||||
.update_settings(json!({"displayedAttributes": ["name", "age"], "searchableAttributes": ["name"], "stopWords": ["the"], "filterableAttributes": ["age"], "synonyms": {"puppy": ["dog", "doggo", "potat"] }}))
|
||||
.await;
|
||||
index.wait_task(update_task.uid()).await;
|
||||
index.wait_task(update_task.uid()).await.succeeded();
|
||||
let (response, code) = index.settings().await;
|
||||
assert_eq!(code, 200);
|
||||
assert_eq!(response["displayedAttributes"], json!(["name", "age"]));
|
||||
@ -437,7 +437,7 @@ async fn reset_all_settings() {
|
||||
assert_eq!(response["filterableAttributes"], json!(["age"]));
|
||||
|
||||
let (delete_task,_status_code) = index.delete_settings().await;
|
||||
index.wait_task(delete_task.uid()).await;
|
||||
index.wait_task(delete_task.uid()).await.succeeded();
|
||||
|
||||
let (response, code) = index.settings().await;
|
||||
assert_eq!(code, 200);
|
||||
@ -507,7 +507,7 @@ async fn set_and_reset_distinct_attribute_with_dedicated_route() {
|
||||
let index = server.index("test");
|
||||
|
||||
let (task, _code) = index.update_distinct_attribute(json!("test")).await;
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index.get_distinct_attribute().await;
|
||||
|
||||
@ -515,7 +515,7 @@ async fn set_and_reset_distinct_attribute_with_dedicated_route() {
|
||||
|
||||
let (task,_status_code) = index.update_distinct_attribute(json!(null)).await;
|
||||
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
let (response, _) = index.get_distinct_attribute().await;
|
||||
|
||||
|
@ -244,7 +244,7 @@ async fn advanced_synergies() {
|
||||
}
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(update_task.uid()).await;
|
||||
index.wait_task(update_task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(json!({"q": "J.R.R.", "attributesToHighlight": ["content"]}), |response, code| {
|
||||
@ -354,7 +354,7 @@ async fn advanced_synergies() {
|
||||
"dictionary": ["J.R.R.", "J. R. R.", "J.K.", "J. K."],
|
||||
}))
|
||||
.await;
|
||||
index.wait_task(_response.uid()).await;
|
||||
index.wait_task(_response.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(json!({"q": "jk", "attributesToHighlight": ["content"]}), |response, code| {
|
||||
|
@ -324,7 +324,7 @@ async fn similar_bad_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();
|
||||
|
||||
let (response, code) =
|
||||
index.similar_post(json!({ "id": 287947, "filter": true, "embedder": "manual" })).await;
|
||||
@ -362,7 +362,7 @@ async fn filter_invalid_syntax_object() {
|
||||
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(json!({"id": 287947, "filter": "title & Glass", "embedder": "manual"}), |response, code| {
|
||||
@ -401,7 +401,7 @@ async fn filter_invalid_syntax_array() {
|
||||
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(json!({"id": 287947, "filter": ["title & Glass"], "embedder": "manual"}), |response, code| {
|
||||
@ -440,7 +440,7 @@ async fn filter_invalid_syntax_string() {
|
||||
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();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "Found unexpected characters at the end of the filter: `XOR title = Glass`. You probably forgot an `OR` or an `AND` rule.\n15:32 title = Glass XOR title = Glass",
|
||||
@ -481,7 +481,7 @@ async fn filter_invalid_attribute_array() {
|
||||
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();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "Attribute `many` is not filterable. Available filterable attributes are: `title`.\n1:5 many = Glass",
|
||||
@ -522,7 +522,7 @@ async fn filter_invalid_attribute_string() {
|
||||
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();
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "Attribute `many` is not filterable. Available filterable attributes are: `title`.\n1:5 many = Glass",
|
||||
@ -563,7 +563,7 @@ async fn filter_reserved_geo_attribute_array() {
|
||||
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();
|
||||
|
||||
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",
|
||||
@ -604,7 +604,7 @@ async fn filter_reserved_geo_attribute_string() {
|
||||
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();
|
||||
|
||||
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",
|
||||
@ -645,7 +645,7 @@ async fn filter_reserved_attribute_array() {
|
||||
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();
|
||||
|
||||
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",
|
||||
@ -686,7 +686,7 @@ async fn filter_reserved_attribute_string() {
|
||||
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();
|
||||
|
||||
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",
|
||||
@ -727,7 +727,7 @@ async fn filter_reserved_geo_point_array() {
|
||||
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();
|
||||
|
||||
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",
|
||||
@ -768,7 +768,7 @@ async fn filter_reserved_geo_point_string() {
|
||||
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();
|
||||
|
||||
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",
|
||||
|
@ -684,7 +684,7 @@ async fn limit_and_offset() {
|
||||
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(
|
||||
|
@ -56,7 +56,7 @@ async fn perform_snapshot() {
|
||||
let (task, code) = server.index("test1").create(Some("prim")).await;
|
||||
meili_snap::snapshot!(code, @"202 Accepted");
|
||||
|
||||
index.wait_task(task.uid()).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
// wait for the _next task_ to process, aka the snapshot that should be enqueued at some point
|
||||
|
||||
|
@ -607,7 +607,7 @@ async fn test_summarized_index_creation() {
|
||||
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, _) = index.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -631,7 +631,7 @@ async fn test_summarized_index_creation() {
|
||||
"###);
|
||||
|
||||
let (task,_status_code) = index.create(Some("doggos")).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]" },
|
||||
@ -775,7 +775,7 @@ async fn test_summarized_index_update() {
|
||||
let index = server.index("test");
|
||||
// If the index doesn't exist yet, we should get errors with or without the primary key.
|
||||
let (task,_status_code) = index.update(None).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]" },
|
||||
@ -804,7 +804,7 @@ async fn test_summarized_index_update() {
|
||||
"###);
|
||||
|
||||
let (task,_status_code) = index.update(Some("bones")).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]" },
|
||||
@ -836,7 +836,7 @@ async fn test_summarized_index_update() {
|
||||
index.create(None).await;
|
||||
|
||||
let (task,_status_code) = index.update(None).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]" },
|
||||
@ -860,7 +860,7 @@ async fn test_summarized_index_update() {
|
||||
"###);
|
||||
|
||||
let (task,_status_code) = index.update(Some("bones")).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]" },
|
||||
@ -892,7 +892,7 @@ async fn test_summarized_index_swap() {
|
||||
{ "indexes": ["doggos", "cattos"] }
|
||||
]))
|
||||
.await;
|
||||
server.wait_task(task.uid()).await;
|
||||
server.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = server.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -934,7 +934,7 @@ async fn test_summarized_index_swap() {
|
||||
{ "indexes": ["doggos", "cattos"] }
|
||||
]))
|
||||
.await;
|
||||
server.wait_task(task.uid()).await;
|
||||
server.wait_task(task.uid()).await.succeeded();
|
||||
let (task, _) = server.get_task(task.uid()).await;
|
||||
assert_json_snapshot!(task,
|
||||
{ ".duration" => "[duration]", ".enqueuedAt" => "[date]", ".startedAt" => "[date]", ".finishedAt" => "[date]" },
|
||||
@ -971,9 +971,9 @@ async fn test_summarized_task_cancelation() {
|
||||
let index = server.index("doggos");
|
||||
// to avoid being flaky we're only going to cancel an already finished task :(
|
||||
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) = server.cancel_tasks("uids=0").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]" },
|
||||
@ -1005,9 +1005,9 @@ async fn test_summarized_task_deletion() {
|
||||
let index = server.index("doggos");
|
||||
// to avoid being flaky we're only going to delete an already finished task :(
|
||||
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) = server.delete_tasks("uids=0").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]" },
|
||||
|
@ -618,7 +618,7 @@ async fn clear_documents() {
|
||||
let index = generate_default_user_provided_documents(&server).await;
|
||||
|
||||
let (value, _code) = index.clear_all_documents().await;
|
||||
index.wait_task(value.uid()).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
// Make sure the documents DB has been cleared
|
||||
let (documents, _code) = index
|
||||
|
Loading…
x
Reference in New Issue
Block a user