From 6a683975bfb91cb3973c950fb20e086d58f2344e Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Tue, 10 Jun 2025 16:58:48 +0300 Subject: [PATCH] More fixes of the tests Signed-off-by: Martin Tzvetanov Grigorov --- crates/meili-snap/src/lib.rs | 20 + crates/meilisearch/tests/common/server.rs | 2 +- crates/meilisearch/tests/search/multi/mod.rs | 625 +++++++++---------- 3 files changed, 333 insertions(+), 314 deletions(-) diff --git a/crates/meili-snap/src/lib.rs b/crates/meili-snap/src/lib.rs index 7ef72ed06..fcd17879e 100644 --- a/crates/meili-snap/src/lib.rs +++ b/crates/meili-snap/src/lib.rs @@ -43,10 +43,30 @@ pub fn default_snapshot_settings_for_test<'a>( } } + fn uuid_in_json_key_redaction(content: Content, _content_path: ContentPath) -> Content { + match content { + Content::Map(map) => { + let new_map = map.iter() + .map(|(key, value)| { + match key { + Content::String(s) => { + let uuid_replaced = UUID_IN_MESSAGE_RE.replace_all(s, "[uuid]"); + (Content::String(uuid_replaced.to_string()), value.clone()) + } + _ => (key.clone(), value.clone()), + } + }).collect(); + Content::Map(new_map) + } + _ => content, + } + } + settings.add_dynamic_redaction(".message", uuid_in_message_redaction); settings.add_dynamic_redaction(".**.message", uuid_in_message_redaction); settings.add_dynamic_redaction(".indexUid", uuid_in_message_redaction); settings.add_dynamic_redaction(".**.indexUid", uuid_in_message_redaction); + settings.add_dynamic_redaction(".facetsByIndex", uuid_in_json_key_redaction); let test_name = test_name.strip_suffix("::{{closure}}").unwrap_or(test_name); let test_name = test_name.rsplit("::").next().unwrap().to_owned(); diff --git a/crates/meilisearch/tests/common/server.rs b/crates/meilisearch/tests/common/server.rs index fecdc5f16..1f5688a02 100644 --- a/crates/meilisearch/tests/common/server.rs +++ b/crates/meilisearch/tests/common/server.rs @@ -350,7 +350,7 @@ impl Server { pub fn unique_index_with_prefix(&self, prefix: &str) -> Index<'_> { let uuid = Uuid::new_v4(); Index { - uid: format!("{prefix}-{}", uuid.to_string()), + uid: format!("{prefix}-{}", uuid), service: &self.service, encoder: Encoder::Plain, marker: PhantomData, diff --git a/crates/meilisearch/tests/search/multi/mod.rs b/crates/meilisearch/tests/search/multi/mod.rs index 3914e7c9d..d75a09364 100644 --- a/crates/meilisearch/tests/search/multi/mod.rs +++ b/crates/meilisearch/tests/search/multi/mod.rs @@ -29,10 +29,10 @@ async fn federation_empty_list() { let (response, code) = server.multi_search(json!({"federation": {}, "queries": []})).await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, {".processingTimeMs" => "[time]"}), @r###" + snapshot!(response, @r###" { "hits": [], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 0 @@ -100,7 +100,7 @@ async fn simple_search_single_index() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response["results"], { "[].processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response["results"], { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" [ { "indexUid": "SHARED_DOCUMENTS", @@ -115,7 +115,7 @@ async fn simple_search_single_index() { } ], "query": "glass", - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 1 @@ -133,7 +133,7 @@ async fn simple_search_single_index() { } ], "query": "captain", - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 1 @@ -153,7 +153,7 @@ async fn federation_single_search_single_index() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -170,7 +170,7 @@ async fn federation_single_search_single_index() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 1 @@ -192,7 +192,7 @@ async fn federation_multiple_search_single_index() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -241,7 +241,7 @@ async fn federation_multiple_search_single_index() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 5 @@ -261,7 +261,7 @@ async fn federation_two_search_single_index() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -291,7 +291,7 @@ async fn federation_two_search_single_index() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 2 @@ -309,7 +309,7 @@ async fn simple_search_missing_index_uid() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, @r###" + snapshot!(response, @r###" { "message": "Missing field `indexUid` inside `.queries[0]`", "code": "missing_index_uid", @@ -329,7 +329,7 @@ async fn federation_simple_search_missing_index_uid() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, @r###" + snapshot!(response, @r###" { "message": "Missing field `indexUid` inside `.queries[0]`", "code": "missing_index_uid", @@ -349,7 +349,7 @@ async fn simple_search_illegal_index_uid() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, @r###" + snapshot!(response, @r###" { "message": "Invalid value at `.queries[0].indexUid`: `hé` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_), and can not be more than 512 bytes.", "code": "invalid_index_uid", @@ -369,7 +369,7 @@ async fn federation_search_illegal_index_uid() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, @r###" + snapshot!(response, @r###" { "message": "Invalid value at `.queries[0].indexUid`: `hé` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_), and can not be more than 512 bytes.", "code": "invalid_index_uid", @@ -393,7 +393,7 @@ async fn simple_search_two_indexes() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response["results"], { "[].processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response["results"], { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" [ { "indexUid": "SHARED_DOCUMENTS", @@ -408,7 +408,7 @@ async fn simple_search_two_indexes() { } ], "query": "glass", - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 1 @@ -449,7 +449,7 @@ async fn simple_search_two_indexes() { } ], "query": "pésti", - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 2 @@ -471,7 +471,7 @@ async fn federation_two_search_two_indexes() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -482,7 +482,7 @@ async fn federation_two_search_two_indexes() { "red" ], "_federation": { - "indexUid": "SHARED_NESTED_DOCUMENTS", + "indexUid": "SHARED_DOCUMENTS", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -529,7 +529,7 @@ async fn federation_two_search_two_indexes() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 3 @@ -562,7 +562,7 @@ async fn federation_multiple_search_multiple_indexes() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -728,7 +728,7 @@ async fn federation_multiple_search_multiple_indexes() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 12 @@ -832,15 +832,14 @@ async fn search_one_query_error() { let (response, code) = server .multi_search(json!({"queries": [ - {"indexUid" : index.uid, "q": "glass", "facets": ["title"]}, + {"indexUid" : index.uid, "q": "glass", "facets": ["color"]}, {"indexUid": nested_index.uid, "q": "pésti"}, ]})) .await; - dbg!(&response); snapshot!(code, @"400 Bad Request"); snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[0]`: Invalid facet distribution: Attribute `title` is not filterable. This index does not have configured filterable attributes.", + "message": "Inside `.queries[0]`: Invalid facet distribution: Attribute `color` is not filterable. Available filterable attributes patterns are: `id, title`.", "code": "invalid_search_facets", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_facets" @@ -864,7 +863,7 @@ async fn federation_one_query_error() { snapshot!(code, @"400 Bad Request"); snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[1]`: Index `SHARED_NESTED_DOCUMENTS`: Attribute `title` is not filterable. This index does not have configured filterable attributes.\n1:6 title = toto", + "message": "Inside `.queries[1]`: Index `SHARED_NESTED_DOCUMENTS`: Attribute `title` is not filterable. Available filterable attribute patterns are: `cattos`, `doggos`, `father`.\n1:6 title = toto", "code": "invalid_search_filter", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_filter" @@ -884,6 +883,7 @@ async fn federation_one_query_sort_error() { {"indexUid": nested_index.uid, "q": "pésti", "sort": ["doggos:desc"]}, ]})) .await; + dbg!(&response); snapshot!(code, @"400 Bad Request"); snapshot!(json_string!(response), @r###" { @@ -903,15 +903,14 @@ async fn search_multiple_query_errors() { let (response, code) = server .multi_search(json!({"queries": [ - {"indexUid" : index.uid, "q": "glass", "facets": ["title"]}, + {"indexUid" : index.uid, "q": "glass", "facets": ["color"]}, {"indexUid": nested_index.uid, "q": "pésti", "facets": ["doggos"]}, ]})) .await; - dbg!(&response); snapshot!(code, @"400 Bad Request"); snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[0]`: Invalid facet distribution: Attribute `title` is not filterable. This index does not have configured filterable attributes.", + "message": "Inside `.queries[0]`: Invalid facet distribution: Attribute `color` is not filterable. Available filterable attributes patterns are: `id, title`.", "code": "invalid_search_facets", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_facets" @@ -927,14 +926,14 @@ async fn federation_multiple_query_errors() { let (response, code) = server .multi_search(json!({"queries": [ - {"indexUid" : index.uid, "q": "glass", "filter": ["title = toto"]}, - {"indexUid": nested_index.uid, "q": "pésti", "filter": ["doggos IN [intel, kefir]"]}, + {"indexUid" : index.uid, "q": "glass", "filter": ["color = toto"]}, + {"indexUid": nested_index.uid, "q": "pésti", "filter": ["mother IN [intel, kefir]"]}, ]})) .await; snapshot!(code, @"400 Bad Request"); snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[0]`: Index `test`: Attribute `title` is not filterable. This index does not have configured filterable attributes.\n1:6 title = toto", + "message": "Inside `.queries[0]`: Index `SHARED_DOCUMENTS`: Attribute `color` is not filterable. Available filterable attribute patterns are: `id`, `title`.\n1:6 color = toto", "code": "invalid_search_filter", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_filter" @@ -950,14 +949,14 @@ async fn federation_multiple_query_sort_errors() { let (response, code) = server .multi_search(json!({"queries": [ - {"indexUid" : index.uid, "q": "glass", "sort": ["title:desc"]}, + {"indexUid" : index.uid, "q": "glass", "sort": ["color:desc"]}, {"indexUid": nested_index.uid, "q": "pésti", "sort": ["doggos:desc"]}, ]})) .await; snapshot!(code, @"400 Bad Request"); snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[0]`: Index `SHARED_DOCUMENTS`: Attribute `title` is not sortable. This index does not have configured sortable attributes.", + "message": "Inside `.queries[0]`: Index `SHARED_DOCUMENTS`: Attribute `color` is not sortable. Available sortable attributes are: `id, title`.", "code": "invalid_search_sort", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_sort" @@ -974,14 +973,14 @@ async fn federation_multiple_query_errors_interleaved() { let (response, code) = server .multi_search(json!({"queries": [ {"indexUid" : index.uid, "q": "glass"}, - {"indexUid": nested_index.uid, "q": "pésti", "filter": ["doggos IN [intel, kefir]"]}, + {"indexUid": nested_index.uid, "q": "pésti", "filter": ["mother IN [intel, kefir]"]}, {"indexUid" : index.uid, "q": "glass", "filter": ["title = toto"]}, ]})) .await; snapshot!(code, @"400 Bad Request"); snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[1]`: Index `SHARED_NESTED_DOCUMENTS`: Attribute `doggos` is not filterable. This index does not have configured filterable attributes.\n1:7 doggos IN [intel, kefir]", + "message": "Inside `.queries[1]`: Index `SHARED_NESTED_DOCUMENTS`: Attribute `mother` is not filterable. Available filterable attribute patterns are: `cattos`, `doggos`, `father`.\n1:7 mother IN [intel, kefir]", "code": "invalid_search_filter", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_filter" @@ -998,14 +997,14 @@ async fn federation_multiple_query_sort_errors_interleaved() { let (response, code) = server .multi_search(json!({"queries": [ {"indexUid" : index.uid, "q": "glass"}, - {"indexUid": nested_index.uid, "q": "pésti", "sort": ["doggos:desc"]}, + {"indexUid": nested_index.uid, "q": "pésti", "sort": ["mother:desc"]}, {"indexUid" : index.uid, "q": "glass", "sort": ["title:desc"]}, ]})) .await; snapshot!(code, @"400 Bad Request"); snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[1]`: Index `SHARED_NESTED_DOCUMENTS`: Attribute `doggos` is not sortable. This index does not have configured sortable attributes.", + "message": "Inside `.queries[1]`: Index `SHARED_NESTED_DOCUMENTS`: Attribute `mother` is not sortable. Available sortable attributes are: `doggos`.", "code": "invalid_search_sort", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_search_sort" @@ -1036,7 +1035,7 @@ async fn federation_filter() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**.indexUid" => "[uuid]" }, @r###" + snapshot!(response, @r###" { "hits": [ { @@ -1072,7 +1071,7 @@ async fn federation_filter() { "_rankingScore": 0.953042328042328 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 3 @@ -1112,7 +1111,7 @@ async fn federation_sort_same_indexes_same_criterion_same_direction() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**.indexUid" => "[uuid]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { @@ -1198,7 +1197,7 @@ async fn federation_sort_same_indexes_same_criterion_same_direction() { "_rankingScore": 1.0 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 4 @@ -1213,7 +1212,7 @@ async fn federation_sort_same_indexes_same_criterion_same_direction() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**.indexUid" => "[uuid]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { @@ -1285,7 +1284,7 @@ async fn federation_sort_same_indexes_same_criterion_same_direction() { "_rankingScore": 0.9848484848484848 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 3 @@ -1325,7 +1324,7 @@ async fn federation_sort_same_indexes_same_criterion_opposite_direction() { ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { "message": "Inside `.queries[1]`: The results of queries #0 and #1 are incompatible: \n 1. `queries[0].sort[0]`, `[uuid].rankingRules[0]`: ascending sort rule(s) on field `mother`\n 2. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `mother`\n - cannot compare two sort rules in opposite directions\n - note: The ranking rules of query #0 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n - note: The ranking rules of query #1 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n", "code": "invalid_multi_search_query_ranking_rules", @@ -1342,7 +1341,7 @@ async fn federation_sort_same_indexes_same_criterion_opposite_direction() { ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { "message": "Inside `.queries[1]`: The results of queries #0 and #1 are incompatible: \n 1. `queries[0].sort[0]`, `[uuid].rankingRules[0]`: ascending sort rule(s) on field `mother`\n 2. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `mother`\n - cannot compare two sort rules in opposite directions\n", "code": "invalid_multi_search_query_ranking_rules", @@ -1384,7 +1383,7 @@ async fn federation_sort_same_indexes_different_criterion_same_direction() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**.indexUid" => "[uuid]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { @@ -1470,7 +1469,7 @@ async fn federation_sort_same_indexes_different_criterion_same_direction() { "_rankingScore": 1.0 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 4 @@ -1486,7 +1485,7 @@ async fn federation_sort_same_indexes_different_criterion_same_direction() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**.indexUid" => "[uuid]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { @@ -1558,7 +1557,7 @@ async fn federation_sort_same_indexes_different_criterion_same_direction() { "_rankingScore": 0.9991181657848324 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 3 @@ -1569,7 +1568,7 @@ async fn federation_sort_same_indexes_different_criterion_same_direction() { #[actix_rt::test] async fn federation_sort_same_indexes_different_criterion_opposite_direction() { let server = Server::new_shared(); - let index = server.unique_index(); + let index = server.unique_index_with_prefix("nested"); let documents = NESTED_DOCUMENTS.clone(); let (value, _) = index.add_documents(documents, None).await; @@ -1598,9 +1597,9 @@ async fn federation_sort_same_indexes_different_criterion_opposite_direction() { ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[1]`: The results of queries #0 and #1 are incompatible: \n 1. `queries[0].sort[0]`, `[uuid].rankingRules[0]`: ascending sort rule(s) on field `mother`\n 2. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `father`\n - cannot compare two sort rules in opposite directions\n - note: The ranking rules of query #0 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n - note: The ranking rules of query #1 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n", + "message": "Inside `.queries[1]`: The results of queries #0 and #1 are incompatible: \n 1. `queries[0].sort[0]`, `nested-[uuid].rankingRules[0]`: ascending sort rule(s) on field `mother`\n 2. `queries[1].sort[0]`, `nested-[uuid].rankingRules[0]`: descending sort rule(s) on field `father`\n - cannot compare two sort rules in opposite directions\n - note: The ranking rules of query #0 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n - note: The ranking rules of query #1 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n", "code": "invalid_multi_search_query_ranking_rules", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_query_ranking_rules" @@ -1615,9 +1614,9 @@ async fn federation_sort_same_indexes_different_criterion_opposite_direction() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[1]`: The results of queries #0 and #1 are incompatible: \n 1. `queries[0].sort[0]`, `nested.rankingRules[0]`: ascending sort rule(s) on field `mother`\n 2. `queries[1].sort[0]`, `nested.rankingRules[0]`: descending sort rule(s) on field `father`\n - cannot compare two sort rules in opposite directions\n", + "message": "Inside `.queries[1]`: The results of queries #0 and #1 are incompatible: \n 1. `queries[0].sort[0]`, `nested-[uuid].rankingRules[0]`: ascending sort rule(s) on field `mother`\n 2. `queries[1].sort[0]`, `nested.rankingRules[0]`: descending sort rule(s) on field `father`\n - cannot compare two sort rules in opposite directions\n", "code": "invalid_multi_search_query_ranking_rules", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_query_ranking_rules" @@ -1678,7 +1677,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { @@ -1802,7 +1801,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { "_rankingScore": 1.0 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 10 @@ -1818,7 +1817,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**.indexUid" => "[uuid]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { @@ -1829,7 +1828,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { "blue" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.9848484848484848 }, @@ -1839,7 +1838,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { "title": "Batman the dark knight returns: Part 2", "id": "B", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 2, "weightedRankingScore": 0.9528218694885362 }, @@ -1849,7 +1848,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { "title": "Batman the dark knight returns: Part 1", "id": "A", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 2, "weightedRankingScore": 0.9528218694885362 }, @@ -1859,7 +1858,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { "title": "Batman Returns", "id": "C", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.8317901234567902 }, @@ -1869,7 +1868,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { "title": "Batman", "id": "D", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.23106060606060605 }, @@ -1879,14 +1878,14 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { "title": "Badman", "id": "E", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.5 }, "_rankingScore": 0.5 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 6 @@ -1898,7 +1897,7 @@ async fn federation_sort_different_indexes_same_criterion_same_direction() { async fn federation_sort_different_ranking_rules() { let server = Server::new_shared(); - let movies_index = server.unique_index(); + let movies_index = server.unique_index_with_prefix("movies"); let documents = DOCUMENTS.clone(); let (value, _) = movies_index.add_documents(documents, None).await; @@ -1919,7 +1918,7 @@ async fn federation_sort_different_ranking_rules() { .await; movies_index.wait_task(value.uid()).await.succeeded(); - let batman_index = server.unique_index(); + let batman_index = server.unique_index_with_prefix("batman"); let documents = SCORE_DOCUMENTS.clone(); let (value, _) = batman_index.add_documents(documents, None).await; @@ -1948,14 +1947,14 @@ async fn federation_sort_different_ranking_rules() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**.indexUid" => "[uuid]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "title": "Badman", "id": "E", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -1965,7 +1964,7 @@ async fn federation_sort_different_ranking_rules() { "title": "Batman", "id": "D", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -1975,7 +1974,7 @@ async fn federation_sort_different_ranking_rules() { "title": "Batman Returns", "id": "C", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -1985,7 +1984,7 @@ async fn federation_sort_different_ranking_rules() { "title": "Batman the dark knight returns: Part 1", "id": "A", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -1995,7 +1994,7 @@ async fn federation_sort_different_ranking_rules() { "title": "Batman the dark knight returns: Part 2", "id": "B", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -2009,7 +2008,7 @@ async fn federation_sort_different_ranking_rules() { "blue" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, @@ -2023,7 +2022,7 @@ async fn federation_sort_different_ranking_rules() { "red" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, @@ -2037,7 +2036,7 @@ async fn federation_sort_different_ranking_rules() { "red" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, @@ -2051,7 +2050,7 @@ async fn federation_sort_different_ranking_rules() { "red" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, @@ -2065,14 +2064,14 @@ async fn federation_sort_different_ranking_rules() { "blue" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, "_rankingScore": 1.0 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 10 @@ -2088,9 +2087,9 @@ async fn federation_sort_different_ranking_rules() { ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[1]`: The results of queries #2 and #1 are incompatible: \n 1. `queries[2]`, `[uuid].rankingRules[0..=3]`: relevancy rule(s) words, typo, proximity, attribute\n 2. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `title`\n - cannot compare a relevancy rule with a sort rule\n", + "message": "Inside `.queries[1]`: The results of queries #2 and #1 are incompatible: \n 1. `queries[2]`, `batman-[uuid].rankingRules[0..=3]`: relevancy rule(s) words, typo, proximity, attribute\n 2. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `title`\n - cannot compare a relevancy rule with a sort rule\n", "code": "invalid_multi_search_query_ranking_rules", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_query_ranking_rules" @@ -2102,7 +2101,7 @@ async fn federation_sort_different_ranking_rules() { async fn federation_sort_different_indexes_same_criterion_opposite_direction() { let server = Server::new_shared(); - let movies_index = server.unique_index(); + let movies_index = server.unique_index_with_prefix("movies"); let documents = DOCUMENTS.clone(); let (value, _) = movies_index.add_documents(documents, None).await; @@ -2123,7 +2122,7 @@ async fn federation_sort_different_indexes_same_criterion_opposite_direction() { .await; movies_index.wait_task(value.uid()).await.succeeded(); - let batman_index = server.unique_index(); + let batman_index = server.unique_index_with_prefix("batman"); let documents = SCORE_DOCUMENTS.clone(); let (value, _) = batman_index.add_documents(documents, None).await; @@ -2152,9 +2151,9 @@ async fn federation_sort_different_indexes_same_criterion_opposite_direction() { ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[0]`: The results of queries #1 and #0 are incompatible: \n 1. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `title`\n 2. `queries[0].sort[0]`, `[uuid].rankingRules[0]`: ascending sort rule(s) on field `title`\n - cannot compare two sort rules in opposite directions\n - note: The ranking rules of query #1 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n - note: The ranking rules of query #0 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n", + "message": "Inside `.queries[0]`: The results of queries #1 and #0 are incompatible: \n 1. `queries[1].sort[0]`, `batman-[uuid].rankingRules[0]`: descending sort rule(s) on field `title`\n 2. `queries[0].sort[0]`, `batman-[uuid].rankingRules[0]`: ascending sort rule(s) on field `title`\n - cannot compare two sort rules in opposite directions\n - note: The ranking rules of query #1 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n - note: The ranking rules of query #0 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n", "code": "invalid_multi_search_query_ranking_rules", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_query_ranking_rules" @@ -2170,7 +2169,7 @@ async fn federation_sort_different_indexes_same_criterion_opposite_direction() { ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { "message": "Inside `.queries[1]`: The results of queries #2 and #1 are incompatible: \n 1. `queries[2].sort[0]`, `[uuid].rankingRules[0]`: ascending sort rule(s) on field `title`\n 2. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `title`\n - cannot compare two sort rules in opposite directions\n", "code": "invalid_multi_search_query_ranking_rules", @@ -2184,7 +2183,7 @@ async fn federation_sort_different_indexes_same_criterion_opposite_direction() { async fn federation_sort_different_indexes_different_criterion_same_direction() { let server = Server::new_shared(); - let movies_index = server.unique_index(); + let movies_index = server.unique_index_with_prefix("movies"); let documents = DOCUMENTS.clone(); let (value, _) = movies_index.add_documents(documents, None).await; @@ -2205,7 +2204,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() .await; movies_index.wait_task(value.uid()).await.succeeded(); - let batman_index = server.unique_index(); + let batman_index = server.unique_index_with_prefix("batman"); let documents = SCORE_DOCUMENTS.clone(); let (value, _) = batman_index.add_documents(documents, None).await; @@ -2234,14 +2233,14 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "title": "Batman the dark knight returns: Part 1", "id": "A", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -2251,7 +2250,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "title": "Batman the dark knight returns: Part 2", "id": "B", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -2261,7 +2260,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "title": "Batman Returns", "id": "C", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -2275,7 +2274,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "blue" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, @@ -2285,7 +2284,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "title": "Batman", "id": "D", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -2295,7 +2294,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "title": "Badman", "id": "E", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 }, @@ -2309,7 +2308,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "red" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, @@ -2323,7 +2322,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "red" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, @@ -2337,7 +2336,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "red" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, @@ -2351,14 +2350,14 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "blue" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 }, "_rankingScore": 1.0 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 10 @@ -2374,14 +2373,14 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "title": "Badman", "id": "E", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.5 }, @@ -2391,7 +2390,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "title": "Batman", "id": "D", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.23106060606060605 }, @@ -2405,7 +2404,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "blue" ], "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.9848484848484848 }, @@ -2415,7 +2414,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "title": "Batman Returns", "id": "C", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.8317901234567902 }, @@ -2425,7 +2424,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "title": "Batman the dark knight returns: Part 2", "id": "B", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 2, "weightedRankingScore": 0.9528218694885362 }, @@ -2435,14 +2434,14 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() "title": "Batman the dark knight returns: Part 1", "id": "A", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 2, "weightedRankingScore": 0.9528218694885362 }, "_rankingScore": 0.9528218694885362 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 6 @@ -2454,7 +2453,7 @@ async fn federation_sort_different_indexes_different_criterion_same_direction() async fn federation_sort_different_indexes_different_criterion_opposite_direction() { let server = Server::new_shared(); - let movies_index = server.unique_index(); + let movies_index = server.unique_index_with_prefix("movies"); let documents = DOCUMENTS.clone(); let (value, _) = movies_index.add_documents(documents, None).await; @@ -2475,7 +2474,7 @@ async fn federation_sort_different_indexes_different_criterion_opposite_directio .await; movies_index.wait_task(value.uid()).await.succeeded(); - let batman_index = server.unique_index(); + let batman_index = server.unique_index_with_prefix("batman"); let documents = SCORE_DOCUMENTS.clone(); let (value, _) = batman_index.add_documents(documents, None).await; @@ -2504,9 +2503,9 @@ async fn federation_sort_different_indexes_different_criterion_opposite_directio ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { - "message": "Inside `.queries[0]`: The results of queries #1 and #0 are incompatible: \n 1. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `id`\n 2. `queries[0].sort[0]`, `[uuid].rankingRules[0]`: ascending sort rule(s) on field `title`\n - cannot compare two sort rules in opposite directions\n - note: The ranking rules of query #1 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n - note: The ranking rules of query #0 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n", + "message": "Inside `.queries[0]`: The results of queries #1 and #0 are incompatible: \n 1. `queries[1].sort[0]`, `batman-[uuid].rankingRules[0]`: descending sort rule(s) on field `id`\n 2. `queries[0].sort[0]`, `batman-[uuid].rankingRules[0]`: ascending sort rule(s) on field `title`\n - cannot compare two sort rules in opposite directions\n - note: The ranking rules of query #1 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n - note: The ranking rules of query #0 were modified during canonicalization:\n 1. Removed relevancy rule `words` at position #1 in ranking rules because the query is a placeholder search (`q`: \"\")\n 2. Removed relevancy rule `typo` at position #2 in ranking rules because the query is a placeholder search (`q`: \"\")\n 3. Removed relevancy rule `proximity` at position #3 in ranking rules because the query is a placeholder search (`q`: \"\")\n 4. Removed relevancy rule `attribute` at position #4 in ranking rules because the query is a placeholder search (`q`: \"\")\n 5. Removed relevancy rule `exactness` at position #5 in ranking rules because the query is a placeholder search (`q`: \"\")\n", "code": "invalid_multi_search_query_ranking_rules", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_query_ranking_rules" @@ -2522,7 +2521,7 @@ async fn federation_sort_different_indexes_different_criterion_opposite_directio ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { "message": "Inside `.queries[1]`: The results of queries #2 and #1 are incompatible: \n 1. `queries[2].sort[0]`, `[uuid].rankingRules[0]`: descending sort rule(s) on field `id`\n 2. `queries[1].sort[0]`, `[uuid].rankingRules[0]`: ascending sort rule(s) on field `title`\n - cannot compare two sort rules in opposite directions\n", "code": "invalid_multi_search_query_ranking_rules", @@ -2535,7 +2534,7 @@ async fn federation_sort_different_indexes_different_criterion_opposite_directio #[actix_rt::test] async fn federation_limit_offset() { let server = Server::new_shared(); - let index = server.unique_index(); + let index = shared_index_with_documents().await; let nested_index = shared_index_with_nested_documents().await; let score_index = shared_index_with_score_documents().await; @@ -2555,8 +2554,9 @@ async fn federation_limit_offset() { {"indexUid" : score_index.uid, "q": "batman returns", "attributesToRetrieve": ["title"]}, ]})) .await; + dbg!(&response); snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -2656,7 +2656,7 @@ async fn federation_limit_offset() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 12 @@ -2681,7 +2681,7 @@ async fn federation_limit_offset() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -2693,7 +2693,7 @@ async fn federation_limit_offset() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 1, "offset": 0, "estimatedTotalHits": 12 @@ -2718,7 +2718,7 @@ async fn federation_limit_offset() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -2802,7 +2802,7 @@ async fn federation_limit_offset() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 2, "estimatedTotalHits": 12 @@ -2827,10 +2827,10 @@ async fn federation_limit_offset() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".**._rankingScore" => "[score]" }), @r###" { "hits": [], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 12, "estimatedTotalHits": 12 @@ -2842,10 +2842,9 @@ async fn federation_limit_offset() { #[actix_rt::test] async fn federation_formatting() { let server = Server::new_shared(); - let index = server.unique_index(); - - let nested_index = server.unique_index(); - let score_index = server.unique_index(); + let index = shared_index_with_documents().await; + let nested_index = shared_index_with_nested_documents().await; + let score_index = shared_index_with_score_documents().await; { let (response, code) = server @@ -2864,7 +2863,7 @@ async fn federation_formatting() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -2991,7 +2990,7 @@ async fn federation_formatting() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 12 @@ -3016,7 +3015,7 @@ async fn federation_formatting() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -3028,7 +3027,7 @@ async fn federation_formatting() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 1, "offset": 0, "estimatedTotalHits": 12 @@ -3053,7 +3052,7 @@ async fn federation_formatting() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -3137,7 +3136,7 @@ async fn federation_formatting() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 2, "estimatedTotalHits": 12 @@ -3162,10 +3161,10 @@ async fn federation_formatting() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }, @r###" + snapshot!(json_string!(response, { ".**._rankingScore" => "[score]" }), @r###" { "hits": [], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 12, "estimatedTotalHits": 12 @@ -3197,7 +3196,7 @@ async fn federation_invalid_weight() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(response, @r###" { "message": "Invalid value at `.queries[1].federationOptions.weight`: the value of `weight` is invalid, expected a positive float (>= 0.0).", "code": "invalid_multi_search_weight", @@ -3211,7 +3210,7 @@ async fn federation_invalid_weight() { async fn federation_null_weight() { let server = Server::new_shared(); - let index = server.unique_index(); + let index = server.unique_index_with_prefix("fruits"); let documents = FRUITS_DOCUMENTS.clone(); let (value, _) = index.add_documents(documents, None).await; @@ -3231,7 +3230,7 @@ async fn federation_null_weight() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { @@ -3239,7 +3238,7 @@ async fn federation_null_weight() { "id": "red-delicious-boosted", "BOOST": true, "_federation": { - "indexUid": "[uuid]", + "indexUid": "fruits-[uuid]", "queriesPosition": 0, "weightedRankingScore": 2.7281746031746033 }, @@ -3250,7 +3249,7 @@ async fn federation_null_weight() { "id": "green-apple-boosted", "BOOST": true, "_federation": { - "indexUid": "[uuid]", + "indexUid": "fruits-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.318181818181818 }, @@ -3260,14 +3259,14 @@ async fn federation_null_weight() { "name": "Red apple gala", "id": "red-apple-gala", "_federation": { - "indexUid": "[uuid]", + "indexUid": "fruits-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.0 }, "_rankingScore": 0.953042328042328 } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 3 @@ -3279,7 +3278,7 @@ async fn federation_null_weight() { async fn federation_federated_contains_pagination() { let server = Server::new_shared(); - let index = server.unique_index(); + let index = server.unique_index_with_prefix("fruits"); let documents = FRUITS_DOCUMENTS.clone(); let (value, _) = index.add_documents(documents, None).await; @@ -3293,7 +3292,7 @@ async fn federation_federated_contains_pagination() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(response, @r###" { "message": "Inside `.queries[1]`: Using pagination options is not allowed in federated queries.\n - Hint: remove `limit` from query #1 or remove `federation` from the request\n - Hint: pass `federation.limit` and `federation.offset` for pagination in federated search", "code": "invalid_multi_search_query_pagination", @@ -3309,7 +3308,7 @@ async fn federation_federated_contains_pagination() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(response, @r###" { "message": "Inside `.queries[1]`: Using pagination options is not allowed in federated queries.\n - Hint: remove `offset` from query #1 or remove `federation` from the request\n - Hint: pass `federation.limit` and `federation.offset` for pagination in federated search", "code": "invalid_multi_search_query_pagination", @@ -3325,7 +3324,7 @@ async fn federation_federated_contains_pagination() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(response, @r###" { "message": "Inside `.queries[1]`: Using pagination options is not allowed in federated queries.\n - Hint: remove `page` from query #1 or remove `federation` from the request\n - Hint: pass `federation.limit` and `federation.offset` for pagination in federated search", "code": "invalid_multi_search_query_pagination", @@ -3341,7 +3340,7 @@ async fn federation_federated_contains_pagination() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(response, @r###" { "message": "Inside `.queries[1]`: Using pagination options is not allowed in federated queries.\n - Hint: remove `hitsPerPage` from query #1 or remove `federation` from the request\n - Hint: pass `federation.limit` and `federation.offset` for pagination in federated search", "code": "invalid_multi_search_query_pagination", @@ -3355,7 +3354,7 @@ async fn federation_federated_contains_pagination() { async fn federation_federated_contains_facets() { let server = Server::new_shared(); - let index = server.unique_index(); + let index = server.unique_index_with_prefix("fruits"); let (value, _) = index .update_settings( @@ -3377,14 +3376,14 @@ async fn federation_federated_contains_facets() { ]})) .await; snapshot!(code, @"200 OK"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]", ".**.indexUid" => "[uuid]" }, @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "name": "Red apple gala", "id": "red-apple-gala", "_federation": { - "indexUid": "[uuid]", + "indexUid": "fruits-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.953042328042328 } @@ -3394,7 +3393,7 @@ async fn federation_federated_contains_facets() { "id": "red-delicious-boosted", "BOOST": true, "_federation": { - "indexUid": "[uuid]", + "indexUid": "fruits-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9093915343915344 } @@ -3404,13 +3403,13 @@ async fn federation_federated_contains_facets() { "id": "green-apple-boosted", "BOOST": true, "_federation": { - "indexUid": "[uuid]", + "indexUid": "fruits-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.4393939393939394 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 3 @@ -3425,7 +3424,7 @@ async fn federation_federated_contains_facets() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(json_string!(response), @r###" { "message": "Inside `.queries[1]`: Using facet options is not allowed in federated queries.\n - Hint: remove `facets` from query #1 or remove `federation` from the request\n - Hint: pass `federation.facetsByIndex.fruits: [\"BOOSTED\"]` for facets in federated search", "code": "invalid_multi_search_query_facets", @@ -3439,7 +3438,7 @@ async fn federation_federated_contains_facets() { async fn federation_non_faceted_for_an_index() { let server = Server::new_shared(); - let fruits_index = server.unique_index(); + let fruits_index = server.unique_index_with_prefix("fruits"); let (value, _) = fruits_index .update_settings( @@ -3449,7 +3448,7 @@ async fn federation_non_faceted_for_an_index() { fruits_index.wait_task(value.uid()).await.succeeded(); - let fruits_no_name_index = server.unique_index(); + let fruits_no_name_index = server.unique_index_with_prefix("fruits-no-name"); let (value, _) = fruits_no_name_index .update_settings( @@ -3459,7 +3458,7 @@ async fn federation_non_faceted_for_an_index() { fruits_no_name_index.wait_task(value.uid()).await.succeeded(); - let fruits_no_facets_index = server.unique_index(); + let fruits_no_facets_index = server.unique_index_with_prefix("fruits-no-facets"); let (value, _) = fruits_no_facets_index.update_settings(json!({"searchableAttributes": ["name"]})).await; @@ -3483,9 +3482,9 @@ async fn federation_non_faceted_for_an_index() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(json_string!(response), @r###" { - "message": "Inside `.federation.facetsByIndex.fruits-no-name`: Invalid facet distribution: Attribute `name` is not filterable. Available filterable attributes patterns are: `BOOST, id`.\n - Note: index `fruits-no-name` used in `.queries[1]`", + "message": "Inside `.federation.facetsByIndex.fruits-no-name-[uuid]`: Invalid facet distribution: Attribute `name` is not filterable. Available filterable attributes patterns are: `BOOST, id`.\n - Note: index `fruits-no-name-[uuid]` used in `.queries[1]`", "code": "invalid_multi_search_facets", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_facets" @@ -3505,9 +3504,9 @@ async fn federation_non_faceted_for_an_index() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(json_string!(response), @r###" { - "message": "Inside `.federation.facetsByIndex.fruits-no-name`: Invalid facet distribution: Attribute `name` is not filterable. Available filterable attributes patterns are: `BOOST, id`.\n - Note: index `fruits-no-name` is not used in queries", + "message": "Inside `.federation.facetsByIndex.fruits-no-name-[uuid]`: Invalid facet distribution: Attribute `name` is not filterable. Available filterable attributes patterns are: `BOOST, id`.\n - Note: index `fruits-no-name-[uuid]` is not used in queries", "code": "invalid_multi_search_facets", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_facets" @@ -3528,9 +3527,9 @@ async fn federation_non_faceted_for_an_index() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r#" + snapshot!(json_string!(response), @r#" { - "message": "Inside `.federation.facetsByIndex.fruits-no-facets`: Invalid facet distribution: Attributes `BOOST, id` are not filterable. This index does not have configured filterable attributes.\n - Note: index `fruits-no-facets` is not used in queries", + "message": "Inside `.federation.facetsByIndex.fruits-no-facets-[uuid]`: Invalid facet distribution: Attributes `BOOST, id` are not filterable. This index does not have configured filterable attributes.\n - Note: index `fruits-no-facets-[uuid]` is not used in queries", "code": "invalid_multi_search_facets", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_facets" @@ -3550,7 +3549,7 @@ async fn federation_non_faceted_for_an_index() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(response, @r###" { "message": "Inside `.federation.facetsByIndex.zorglub`: Index `zorglub` not found.\n - Note: index `zorglub` is not used in queries", "code": "index_not_found", @@ -3578,7 +3577,7 @@ async fn federation_non_federated_contains_federation_option() { ]})) .await; snapshot!(code, @"400 Bad Request"); - insta::assert_json_snapshot!(response, { ".processingTimeMs" => "[time]" }, @r###" + snapshot!(response, @r###" { "message": "Inside `.queries[1]`: Using `federationOptions` is not allowed in a non-federated search.\n - Hint: remove `federationOptions` from query #1 or add `federation` to the request.", "code": "invalid_multi_search_federation_options", @@ -3621,7 +3620,7 @@ async fn federation_vector_single_index() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -3661,7 +3660,7 @@ async fn federation_vector_single_index() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 4, @@ -3678,7 +3677,7 @@ async fn federation_vector_single_index() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -3718,7 +3717,7 @@ async fn federation_vector_single_index() { } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 4, @@ -3736,7 +3735,7 @@ async fn federation_vector_single_index() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }), @r###" + snapshot!(json_string!(response, { ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -3780,7 +3779,7 @@ async fn federation_vector_single_index() { "_rankingScore": "[score]" } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 4, @@ -3793,7 +3792,7 @@ async fn federation_vector_single_index() { async fn federation_vector_two_indexes() { let server = Server::new_shared(); - let vectors_animal_index = server.unique_index(); + let vectors_animal_index = server.unique_index_with_prefix("vectors-animal"); let (value, _) = vectors_animal_index .update_settings(json!({"embedders": { @@ -3810,7 +3809,7 @@ async fn federation_vector_two_indexes() { snapshot!(code, @"202 Accepted"); vectors_animal_index.wait_task(value.uid()).await.succeeded(); - let vectors_sentiment_index = server.unique_index(); + let vectors_sentiment_index = server.unique_index_with_prefix("vectors-sentiment"); let (value, _) = vectors_sentiment_index .update_settings(json!({"embedders": { @@ -3836,7 +3835,7 @@ async fn federation_vector_two_indexes() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]", ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -3859,7 +3858,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.979868710041046 } @@ -3884,7 +3883,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-animal-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9728479385375975 } @@ -3909,7 +3908,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-animal-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9701486229896544 } @@ -3934,7 +3933,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 2, "weightedRankingScore": 0.9242424242424242 } @@ -3959,7 +3958,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 2, "weightedRankingScore": 0.9242424242424242 } @@ -3984,7 +3983,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-animal-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.8601469993591309 } @@ -4009,7 +4008,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-animal-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.8432406187057495 } @@ -4034,13 +4033,13 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.6690993905067444 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 8, @@ -4056,7 +4055,7 @@ async fn federation_vector_two_indexes() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]", ".**._rankingScore" => "[score]" }), @r###" + snapshot!(json_string!(response, { ".**._rankingScore" => "[score]" }), @r###" { "hits": [ { @@ -4079,7 +4078,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9728479385375975 }, @@ -4105,7 +4104,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9701486229896544 }, @@ -4131,7 +4130,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.9522157907485962 }, @@ -4157,7 +4156,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.8719604015350342 }, @@ -4183,7 +4182,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.8601469993591309 }, @@ -4209,7 +4208,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.8432406187057495 }, @@ -4235,7 +4234,7 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.8297949433326721 }, @@ -4261,14 +4260,14 @@ async fn federation_vector_two_indexes() { } }, "_federation": { - "indexUid": "[uuid]", + "indexUid": "vectors-sentiment-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.18887794017791748 }, "_rankingScore": "[score]" } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 8, @@ -4281,7 +4280,7 @@ async fn federation_vector_two_indexes() { async fn federation_facets_different_indexes_same_facet() { let server = Server::new_shared(); - let movies_index = server.unique_index(); + let movies_index = server.unique_index_with_prefix("movies"); let documents = DOCUMENTS.clone(); let (value, _) = movies_index.add_documents(documents, None).await; @@ -4303,7 +4302,7 @@ async fn federation_facets_different_indexes_same_facet() { .await; movies_index.wait_task(value.uid()).await.succeeded(); - let batman_index = server.unique_index(); + let batman_index = server.unique_index_with_prefix("batman"); let documents = SCORE_DOCUMENTS.clone(); let (value, _) = batman_index.add_documents(documents, None).await; @@ -4325,7 +4324,7 @@ async fn federation_facets_different_indexes_same_facet() { .await; batman_index.wait_task(value.uid()).await.succeeded(); - let batman_2_index = server.unique_index(); + let batman_2_index = server.unique_index_with_prefix("batman-2"); let documents = SCORE_DOCUMENTS.clone(); let (value, _) = batman_2_index.add_documents(documents, None).await; @@ -4362,13 +4361,13 @@ async fn federation_facets_different_indexes_same_facet() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "title": "Badman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4376,7 +4375,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Badman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4384,7 +4383,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4392,7 +4391,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4400,7 +4399,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman Returns", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4408,7 +4407,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman Returns", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4416,7 +4415,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 1", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4424,7 +4423,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 1", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4432,7 +4431,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 2", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4440,7 +4439,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 2", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4448,7 +4447,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Captain Marvel", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -4456,7 +4455,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Escape Room", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -4464,7 +4463,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Gläss", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -4472,7 +4471,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "How to Train Your Dragon: The Hidden World", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -4480,18 +4479,18 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Shazam!", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 15, "facetsByIndex": { - "batman": { + "batman-[uuid]": { "distribution": { "title": { "Badman": 1, @@ -4503,7 +4502,7 @@ async fn federation_facets_different_indexes_same_facet() { }, "stats": {} }, - "batman-2": { + "batman-2-[uuid]": { "distribution": { "title": { "Badman": 1, @@ -4515,7 +4514,7 @@ async fn federation_facets_different_indexes_same_facet() { }, "stats": {} }, - "movies": { + "movies-[uuid]": { "distribution": { "color": { "blue": 3, @@ -4552,13 +4551,13 @@ async fn federation_facets_different_indexes_same_facet() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "title": "Badman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4566,7 +4565,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Badman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4574,7 +4573,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4582,7 +4581,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4590,7 +4589,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman Returns", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4598,7 +4597,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman Returns", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4606,7 +4605,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 1", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4614,7 +4613,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 1", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4622,7 +4621,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 2", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -4630,7 +4629,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 2", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -4638,7 +4637,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Captain Marvel", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -4646,7 +4645,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Escape Room", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -4654,7 +4653,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Gläss", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -4662,7 +4661,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "How to Train Your Dragon: The Hidden World", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -4670,13 +4669,13 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Shazam!", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 15, @@ -4714,13 +4713,13 @@ async fn federation_facets_different_indexes_same_facet() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "title": "Captain Marvel", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 2, "weightedRankingScore": 0.9848484848484848 } @@ -4728,7 +4727,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 2", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 3, "weightedRankingScore": 0.9528218694885362 } @@ -4736,7 +4735,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 2", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.7028218694885362 } @@ -4744,7 +4743,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 1", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 3, "weightedRankingScore": 0.9528218694885362 } @@ -4752,7 +4751,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman the dark knight returns: Part 1", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.7028218694885362 } @@ -4760,7 +4759,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman Returns", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.8317901234567902 } @@ -4768,7 +4767,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman Returns", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.8317901234567902 } @@ -4776,7 +4775,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.23106060606060605 } @@ -4784,7 +4783,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Batman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.23106060606060605 } @@ -4792,7 +4791,7 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Badman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.5 } @@ -4800,18 +4799,18 @@ async fn federation_facets_different_indexes_same_facet() { { "title": "Badman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.5 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 11, "facetsByIndex": { - "batman": { + "batman-[uuid]": { "distribution": { "title": { "Badman": 1, @@ -4823,7 +4822,7 @@ async fn federation_facets_different_indexes_same_facet() { }, "stats": {} }, - "batman-2": { + "batman-2-[uuid]": { "distribution": { "title": { "Badman": 1, @@ -4835,7 +4834,7 @@ async fn federation_facets_different_indexes_same_facet() { }, "stats": {} }, - "movies": { + "movies-[uuid]": { "distribution": {}, "stats": {} } @@ -4848,7 +4847,7 @@ async fn federation_facets_different_indexes_same_facet() { async fn federation_facets_same_indexes() { let server = Server::new_shared(); - let doggos_index = server.unique_index(); + let doggos_index = server.unique_index_with_prefix("doggos"); let documents = NESTED_DOCUMENTS.clone(); let (value, _) = doggos_index.add_documents(documents, None).await; @@ -4869,7 +4868,7 @@ async fn federation_facets_same_indexes() { .await; doggos_index.wait_task(value.uid()).await.succeeded(); - let doggos2_index = server.unique_index(); + let doggos2_index = server.unique_index_with_prefix("doggos-2"); let documents = NESTED_DOCUMENTS.clone(); let (value, _) = doggos2_index.add_documents(documents, None).await; @@ -4901,13 +4900,13 @@ async fn federation_facets_same_indexes() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "id": 852, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9621212121212122 } @@ -4915,7 +4914,7 @@ async fn federation_facets_same_indexes() { { "id": 951, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9621212121212122 } @@ -4923,18 +4922,18 @@ async fn federation_facets_same_indexes() { { "id": 750, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.9621212121212122 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 3, "facetsByIndex": { - "doggos": { + "doggos-[uuid]": { "distribution": { "doggos.age": { "2": 1, @@ -4975,13 +4974,13 @@ async fn federation_facets_same_indexes() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { "hits": [ { "id": 852, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9621212121212122 } @@ -4989,7 +4988,7 @@ async fn federation_facets_same_indexes() { { "id": 951, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9621212121212122 } @@ -4997,7 +4996,7 @@ async fn federation_facets_same_indexes() { { "id": 852, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.9621212121212122 } @@ -5005,18 +5004,18 @@ async fn federation_facets_same_indexes() { { "id": 750, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.9621212121212122 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 4, "facetsByIndex": { - "doggos": { + "doggos-[uuid]": { "distribution": { "doggos.age": { "2": 1, @@ -5040,7 +5039,7 @@ async fn federation_facets_same_indexes() { } } }, - "doggos-2": { + "doggos-2-[uuid]": { "distribution": { "doggos.age": { "2": 1, @@ -5078,13 +5077,13 @@ async fn federation_facets_same_indexes() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { "hits": [ { "id": 852, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9621212121212122 } @@ -5092,7 +5091,7 @@ async fn federation_facets_same_indexes() { { "id": 951, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-[uuid]", "queriesPosition": 0, "weightedRankingScore": 0.9621212121212122 } @@ -5100,7 +5099,7 @@ async fn federation_facets_same_indexes() { { "id": 852, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.9621212121212122 } @@ -5108,13 +5107,13 @@ async fn federation_facets_same_indexes() { { "id": 750, "_federation": { - "indexUid": "[uuid]", + "indexUid": "doggos-2-[uuid]", "queriesPosition": 1, "weightedRankingScore": 0.9621212121212122 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 4, @@ -5149,7 +5148,7 @@ async fn federation_facets_same_indexes() { async fn federation_inconsistent_merge_order() { let server = Server::new_shared(); - let movies_index = server.unique_index(); + let movies_index = server.unique_index_with_prefix("movies"); let documents = DOCUMENTS.clone(); let (value, _) = movies_index.add_documents(documents, None).await; @@ -5171,7 +5170,7 @@ async fn federation_inconsistent_merge_order() { .await; movies_index.wait_task(value.uid()).await.succeeded(); - let movies2_index = server.unique_index(); + let movies2_index = server.unique_index_with_prefix("movies-2"); let documents = DOCUMENTS.clone(); let (value, _) = movies2_index.add_documents(documents, None).await; @@ -5196,7 +5195,7 @@ async fn federation_inconsistent_merge_order() { .await; movies2_index.wait_task(value.uid()).await.succeeded(); - let batman_index = server.unique_index(); + let batman_index = server.unique_index_with_prefix("batman"); let documents = SCORE_DOCUMENTS.clone(); let (value, _) = batman_index.add_documents(documents, None).await; @@ -5233,13 +5232,13 @@ async fn federation_inconsistent_merge_order() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###" { "hits": [ { "title": "Badman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5247,7 +5246,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Batman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5255,7 +5254,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Batman Returns", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5263,7 +5262,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Batman the dark knight returns: Part 1", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5271,7 +5270,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Batman the dark knight returns: Part 2", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5279,7 +5278,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Captain Marvel", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5287,7 +5286,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Captain Marvel", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -5295,7 +5294,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Escape Room", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5303,7 +5302,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Escape Room", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -5311,7 +5310,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Gläss", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5319,7 +5318,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Gläss", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -5327,7 +5326,7 @@ async fn federation_inconsistent_merge_order() { { "title": "How to Train Your Dragon: The Hidden World", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5335,7 +5334,7 @@ async fn federation_inconsistent_merge_order() { { "title": "How to Train Your Dragon: The Hidden World", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -5343,7 +5342,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Shazam!", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5351,18 +5350,18 @@ async fn federation_inconsistent_merge_order() { { "title": "Shazam!", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 15, "facetsByIndex": { - "batman": { + "batman-[uuid]": { "distribution": { "title": { "Badman": 1, @@ -5374,7 +5373,7 @@ async fn federation_inconsistent_merge_order() { }, "stats": {} }, - "movies": { + "movies-[uuid]": { "distribution": { "color": { "blue": 3, @@ -5392,7 +5391,7 @@ async fn federation_inconsistent_merge_order() { }, "stats": {} }, - "movies-2": { + "movies-2-[uuid]": { "distribution": { "color": { "red": 3, @@ -5430,9 +5429,9 @@ async fn federation_inconsistent_merge_order() { ]})) .await; snapshot!(code, @"400 Bad Request"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { - "message": "Inside `.federation.facetsByIndex.movies-2`: Inconsistent order for values in facet `color`: index `[uuid]` orders alphabetically, but index `[uuid]` orders by count.\n - Hint: Remove `federation.mergeFacets` or change `faceting.sortFacetValuesBy` to be consistent in settings.\n - Note: index `[uuid]` used in `.queries[2]`", + "message": "Inside `.federation.facetsByIndex.movies-2-[uuid]`: Inconsistent order for values in facet `color`: index `movies-[uuid]` orders alphabetically, but index `movies-2-[uuid]` orders by count.\n - Hint: Remove `federation.mergeFacets` or change `faceting.sortFacetValuesBy` to be consistent in settings.\n - Note: index `movies-2-[uuid]` used in `.queries[2]`", "code": "invalid_multi_search_facet_order", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_multi_search_facet_order" @@ -5457,13 +5456,13 @@ async fn federation_inconsistent_merge_order() { ]})) .await; snapshot!(code, @"200 OK"); - snapshot!(json_string!(response, { ".processingTimeMs" => "[time]" }), @r###" + snapshot!(json_string!(response), @r###" { "hits": [ { "title": "Badman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5471,7 +5470,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Batman", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5479,7 +5478,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Batman Returns", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5487,7 +5486,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Batman the dark knight returns: Part 1", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5495,7 +5494,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Batman the dark knight returns: Part 2", "_federation": { - "indexUid": "[uuid]", + "indexUid": "batman-[uuid]", "queriesPosition": 1, "weightedRankingScore": 1.0 } @@ -5503,7 +5502,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Captain Marvel", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5511,7 +5510,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Captain Marvel", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -5519,7 +5518,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Escape Room", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5527,7 +5526,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Escape Room", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -5535,7 +5534,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Gläss", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5543,7 +5542,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Gläss", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -5551,7 +5550,7 @@ async fn federation_inconsistent_merge_order() { { "title": "How to Train Your Dragon: The Hidden World", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5559,7 +5558,7 @@ async fn federation_inconsistent_merge_order() { { "title": "How to Train Your Dragon: The Hidden World", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } @@ -5567,7 +5566,7 @@ async fn federation_inconsistent_merge_order() { { "title": "Shazam!", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-[uuid]", "queriesPosition": 0, "weightedRankingScore": 1.0 } @@ -5575,13 +5574,13 @@ async fn federation_inconsistent_merge_order() { { "title": "Shazam!", "_federation": { - "indexUid": "[uuid]", + "indexUid": "movies-2-[uuid]", "queriesPosition": 2, "weightedRankingScore": 1.0 } } ], - "processingTimeMs": "[time]", + "processingTimeMs": "[duration]", "limit": 20, "offset": 0, "estimatedTotalHits": 15,