diff --git a/meilisearch-http/src/routes/swap_indexes.rs b/meilisearch-http/src/routes/swap_indexes.rs index 965b1bc55..d0e73569a 100644 --- a/meilisearch-http/src/routes/swap_indexes.rs +++ b/meilisearch-http/src/routes/swap_indexes.rs @@ -1,4 +1,4 @@ -use std::collections::HashSet; +use std::collections::BTreeSet; use actix_web::web::Data; use actix_web::{web, HttpResponse}; @@ -29,10 +29,10 @@ pub async fn swap_indexes( let search_rules = &index_scheduler.filters().search_rules; let mut swaps = vec![]; - let mut indexes_set = HashSet::::default(); - let mut unauthorized_indexes = HashSet::new(); - let mut unknown_indexes = HashSet::new(); - let mut duplicate_indexes = HashSet::new(); + let mut indexes_set = BTreeSet::::default(); + let mut unauthorized_indexes = BTreeSet::new(); + let mut unknown_indexes = BTreeSet::new(); + let mut duplicate_indexes = BTreeSet::new(); for SwapIndexesPayload { indexes } in params.into_inner().into_iter() { let (lhs, rhs) = match indexes.as_slice() { [lhs, rhs] => (lhs, rhs), diff --git a/meilisearch-http/tests/tasks/.mod.rs.pending-snap b/meilisearch-http/tests/tasks/.mod.rs.pending-snap new file mode 100644 index 000000000..f60c5d71d --- /dev/null +++ b/meilisearch-http/tests/tasks/.mod.rs.pending-snap @@ -0,0 +1,52 @@ +{"run_id":"1666789267-794995000","line":687,"new":{"module_name":"integration__tasks","snapshot_name":"summarized_index_swap","metadata":{"source":"meilisearch-http/tests/tasks/mod.rs","assertion_line":687,"expression":"v"},"snapshot":"{\n \"message\": \"Indexes `cattos`, `doggos` not found.\",\n \"code\": \"index_not_found\",\n \"type\": \"invalid_request\",\n \"link\": \"https://docs.meilisearch.com/errors#index_not_found\"\n}"},"old":{"module_name":"integration__tasks","metadata":{},"snapshot":"{\n \"message\": \"Indexes `doggos`, `cattos` not found.\",\n \"code\": \"index_not_found\",\n \"type\": \"invalid_request\",\n \"link\": \"https://docs.meilisearch.com/errors#index_not_found\"\n}"}} +{"run_id":"1666789267-794995000","line":582,"new":null,"old":null} +{"run_id":"1666789267-794995000","line":609,"new":null,"old":null} +{"run_id":"1666789267-794995000","line":639,"new":null,"old":null} +{"run_id":"1666789267-794995000","line":660,"new":null,"old":null} +{"run_id":"1666789267-794995000","line":389,"new":null,"old":null} +{"run_id":"1666789267-794995000","line":418,"new":null,"old":null} +{"run_id":"1666789267-794995000","line":741,"new":null,"old":null} +{"run_id":"1666789267-794995000","line":772,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":331,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":275,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":304,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":360,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":226,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":799,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":454,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":475,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":507,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":248,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":533,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":555,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":687,"new":{"module_name":"integration__tasks","snapshot_name":"summarized_index_swap","metadata":{"source":"meilisearch-http/tests/tasks/mod.rs","assertion_line":687,"expression":"v"},"snapshot":"{\n \"message\": \"Indexes `cattos`, `doggos` not found.\",\n \"code\": \"index_not_found\",\n \"type\": \"invalid_request\",\n \"link\": \"https://docs.meilisearch.com/errors#index_not_found\"\n}"},"old":{"module_name":"integration__tasks","metadata":{},"snapshot":"{\n \"message\": \"Indexes `doggos`, `cattos` not found.\",\n \"code\": \"index_not_found\",\n \"type\": \"invalid_request\",\n \"link\": \"https://docs.meilisearch.com/errors#index_not_found\"\n}"}} +{"run_id":"1666789494-111527000","line":582,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":389,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":609,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":418,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":639,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":660,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":741,"new":null,"old":null} +{"run_id":"1666789494-111527000","line":772,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":275,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":331,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":360,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":304,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":799,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":454,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":226,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":475,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":507,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":687,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":705,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":582,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":609,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":639,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":660,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":389,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":418,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":741,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":772,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":248,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":533,"new":null,"old":null} +{"run_id":"1666789656-901749000","line":555,"new":null,"old":null} diff --git a/meilisearch-http/tests/tasks/mod.rs b/meilisearch-http/tests/tasks/mod.rs index ac91e6a87..d41094c2f 100644 --- a/meilisearch-http/tests/tasks/mod.rs +++ b/meilisearch-http/tests/tasks/mod.rs @@ -686,7 +686,7 @@ async fn test_summarized_index_swap() { .await; assert_json_snapshot!(v, @r###" { - "message": "Indexes `doggos`, `cattos` not found.", + "message": "Indexes `cattos`, `doggos` not found.", "code": "index_not_found", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#index_not_found" diff --git a/meilisearch-types/src/keys.rs b/meilisearch-types/src/keys.rs index 89073c3ad..cb0ec807e 100644 --- a/meilisearch-types/src/keys.rs +++ b/meilisearch-types/src/keys.rs @@ -339,7 +339,9 @@ pub enum Error { MissingParameter(&'static str), #[error("`actions` field value `{0}` is invalid. It should be an array of string representing action names.")] InvalidApiKeyActions(Value), - #[error("`indexes` field value `{0}` is invalid. It should be an array of string representing index names.")] + #[error( + "`{0}` is not a valid index uid. It should be an array of string representing index names." + )] InvalidApiKeyIndexes(Value), #[error("`expiresAt` field value `{0}` is invalid. It should follow the RFC 3339 format to represents a date or datetime in the future or specified as a null value. e.g. 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'.")] InvalidApiKeyExpiresAt(Value),