From 7a80c0dfb317eb37f6cbb75a502523a09a1367d2 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Mon, 3 Jul 2023 11:52:43 +0200 Subject: [PATCH] Fix invalid attributeToSearchOn error code to be consistent with the others search parameters error codes --- meilisearch-types/src/error.rs | 4 ++-- meilisearch/src/routes/indexes/facet_search.rs | 2 +- meilisearch/src/routes/indexes/search.rs | 2 +- meilisearch/src/search.rs | 4 ++-- meilisearch/tests/search/errors.rs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/meilisearch-types/src/error.rs b/meilisearch-types/src/error.rs index c25683e3e..36b760cd7 100644 --- a/meilisearch-types/src/error.rs +++ b/meilisearch-types/src/error.rs @@ -226,7 +226,7 @@ InvalidIndexLimit , InvalidRequest , BAD_REQUEST ; InvalidIndexOffset , InvalidRequest , BAD_REQUEST ; InvalidIndexPrimaryKey , InvalidRequest , BAD_REQUEST ; InvalidIndexUid , InvalidRequest , BAD_REQUEST ; -InvalidAttributesToSearchOn , InvalidRequest , BAD_REQUEST ; +InvalidSearchAttributesToSearchOn , InvalidRequest , BAD_REQUEST ; InvalidSearchAttributesToCrop , InvalidRequest , BAD_REQUEST ; InvalidSearchAttributesToHighlight , InvalidRequest , BAD_REQUEST ; InvalidSearchAttributesToRetrieve , InvalidRequest , BAD_REQUEST ; @@ -342,7 +342,7 @@ impl ErrorCode for milli::Error { UserError::InvalidFacetsDistribution { .. } => Code::InvalidSearchFacets, UserError::InvalidSortableAttribute { .. } => Code::InvalidSearchSort, UserError::InvalidSearchableAttribute { .. } => { - Code::InvalidAttributesToSearchOn + Code::InvalidSearchAttributesToSearchOn } UserError::InvalidFacetSearchFacetName { .. } => { Code::InvalidFacetSearchFacetName diff --git a/meilisearch/src/routes/indexes/facet_search.rs b/meilisearch/src/routes/indexes/facet_search.rs index 5a5c04f99..831c45a85 100644 --- a/meilisearch/src/routes/indexes/facet_search.rs +++ b/meilisearch/src/routes/indexes/facet_search.rs @@ -40,7 +40,7 @@ pub struct FacetSearchQuery { pub filter: Option, #[deserr(default, error = DeserrJsonError, default)] pub matching_strategy: MatchingStrategy, - #[deserr(default, error = DeserrJsonError, default)] + #[deserr(default, error = DeserrJsonError, default)] pub attributes_to_search_on: Option>, } diff --git a/meilisearch/src/routes/indexes/search.rs b/meilisearch/src/routes/indexes/search.rs index a79f95ee4..4d17adee6 100644 --- a/meilisearch/src/routes/indexes/search.rs +++ b/meilisearch/src/routes/indexes/search.rs @@ -72,7 +72,7 @@ pub struct SearchQueryGet { crop_marker: String, #[deserr(default, error = DeserrQueryParamError)] matching_strategy: MatchingStrategy, - #[deserr(default, error = DeserrQueryParamError)] + #[deserr(default, error = DeserrQueryParamError)] pub attributes_to_search_on: Option>, } diff --git a/meilisearch/src/search.rs b/meilisearch/src/search.rs index 5f055703c..1a1c7721e 100644 --- a/meilisearch/src/search.rs +++ b/meilisearch/src/search.rs @@ -83,7 +83,7 @@ pub struct SearchQuery { pub crop_marker: String, #[deserr(default, error = DeserrJsonError, default)] pub matching_strategy: MatchingStrategy, - #[deserr(default, error = DeserrJsonError, default)] + #[deserr(default, error = DeserrJsonError, default)] pub attributes_to_search_on: Option>, } @@ -142,7 +142,7 @@ pub struct SearchQueryWithIndex { pub crop_marker: String, #[deserr(default, error = DeserrJsonError, default)] pub matching_strategy: MatchingStrategy, - #[deserr(default, error = DeserrJsonError, default)] + #[deserr(default, error = DeserrJsonError, default)] pub attributes_to_search_on: Option>, } diff --git a/meilisearch/tests/search/errors.rs b/meilisearch/tests/search/errors.rs index 273472d46..3d34de0fd 100644 --- a/meilisearch/tests/search/errors.rs +++ b/meilisearch/tests/search/errors.rs @@ -980,9 +980,9 @@ async fn search_on_unknown_field() { snapshot!(json_string!(response), @r###" { "message": "Attribute `unknown` is not searchable. Available searchable attributes are: `id, title`.", - "code": "invalid_attributes_to_search_on", + "code": "invalid_search_attributes_to_search_on", "type": "invalid_request", - "link": "https://docs.meilisearch.com/errors#invalid_attributes_to_search_on" + "link": "https://docs.meilisearch.com/errors#invalid_search_attributes_to_search_on" } "###); },