diff --git a/meilisearch-core/src/database.rs b/meilisearch-core/src/database.rs index f66d292f0..8771807f8 100644 --- a/meilisearch-core/src/database.rs +++ b/meilisearch-core/src/database.rs @@ -1059,12 +1059,12 @@ mod tests { let data = r#" { "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)" ], "searchableAttributes": ["name", "release_date"], diff --git a/meilisearch-http/tests/common.rs b/meilisearch-http/tests/common.rs index c30888cbe..3e7ca0608 100644 --- a/meilisearch-http/tests/common.rs +++ b/meilisearch-http/tests/common.rs @@ -57,13 +57,13 @@ pub fn enrich_server_with_movies_settings( ) -> Result<(), Box> { let json = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", + "typo", + "words", + "proximity", + "attribute", + "words_position", "dsc(popularity)", - "_exactness", + "exactness", "dsc(vote_average)", ], "distinctAttribute": null, diff --git a/meilisearch-http/tests/search.rs b/meilisearch-http/tests/search.rs index 42fd901e2..20e2d9b63 100644 --- a/meilisearch-http/tests/search.rs +++ b/meilisearch-http/tests/search.rs @@ -626,13 +626,13 @@ fn search_with_settings_basic() { let config = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", + "typo", + "words", + "proximity", + "attribute", + "words_position", "dsc(popularity)", - "_exactness", + "exactness", "dsc(vote_average)" ], "distinctAttribute": null, @@ -732,13 +732,13 @@ fn search_with_settings_stop_words() { let config = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", + "typo", + "words", + "proximity", + "attribute", + "words_position", "dsc(popularity)", - "_exactness", + "exactness", "dsc(vote_average)" ], "distinctAttribute": null, @@ -839,13 +839,13 @@ fn search_with_settings_synonyms() { let config = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", + "typo", + "words", + "proximity", + "attribute", + "words_position", "dsc(popularity)", - "_exactness", + "exactness", "dsc(vote_average)" ], "distinctAttribute": null, @@ -951,13 +951,13 @@ fn search_with_settings_ranking_rules() { let config = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", + "typo", + "words", + "proximity", + "attribute", + "words_position", "asc(vote_average)", - "_exactness", + "exactness", "dsc(popularity)" ], "distinctAttribute": null, @@ -1058,13 +1058,13 @@ fn search_with_settings_searchable_attributes() { let config = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", + "typo", + "words", + "proximity", + "attribute", + "words_position", "dsc(popularity)", - "_exactness", + "exactness", "dsc(vote_average)" ], "distinctAttribute": null, @@ -1164,13 +1164,13 @@ fn search_with_settings_displayed_attributes() { let config = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", + "typo", + "words", + "proximity", + "attribute", + "words_position", "dsc(popularity)", - "_exactness", + "exactness", "dsc(vote_average)" ], "distinctAttribute": null, @@ -1235,13 +1235,13 @@ fn search_with_settings_searchable_attributes_2() { let config = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", + "typo", + "words", + "proximity", + "attribute", + "words_position", "dsc(popularity)", - "_exactness", + "exactness", "dsc(vote_average)" ], "distinctAttribute": null, diff --git a/meilisearch-http/tests/settings.rs b/meilisearch-http/tests/settings.rs index 5062616f9..eccde51c9 100644 --- a/meilisearch-http/tests/settings.rs +++ b/meilisearch-http/tests/settings.rs @@ -41,12 +41,12 @@ fn write_all_and_delete() { let json = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)", "dsc(rank)", ], @@ -126,10 +126,33 @@ fn write_all_and_delete() { let res_value: Value = serde_json::from_slice(&buf).unwrap(); let json = json!({ - "rankingRules": null, + "rankingRules": [ + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness" + ], "distinctAttribute": null, - "searchableAttributes": null, - "displayedAttributes": null, + "searchableAttributes": [ + "id", + "release_date", + "poster", + "description", + "title", + "movie_id", + "rank" + ], + "displayedAttributes": [ + "movie_id", + "description", + "poster", + "id", + "release_date", + "rank", + "title" + ], "stopWords": null, "synonyms": null, "acceptNewFields": true, @@ -169,12 +192,12 @@ fn write_all_and_update() { let json = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)", "dsc(rank)", ], @@ -235,12 +258,12 @@ fn write_all_and_update() { let json_update = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)", ], "searchableAttributes": [ @@ -288,12 +311,12 @@ fn write_all_and_update() { let res_expected = json!({ "rankingRules": [ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)", ], "distinctAttribute": null, diff --git a/meilisearch-http/tests/settings_ranking_rules.rs b/meilisearch-http/tests/settings_ranking_rules.rs index b310df3cd..73ef8c988 100644 --- a/meilisearch-http/tests/settings_ranking_rules.rs +++ b/meilisearch-http/tests/settings_ranking_rules.rs @@ -39,12 +39,12 @@ fn write_all_and_delete() { // 2 - Send the settings let json = json!([ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)", "dsc(rank)", ]); @@ -95,7 +95,14 @@ fn write_all_and_delete() { block_on(res.into_body().read_to_end(&mut buf)).unwrap(); let res_value: Value = serde_json::from_slice(&buf).unwrap(); - let json = json!(null); + let json = json!([ + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness" + ]); assert_json_eq!(json, res_value, ordered: false); } @@ -130,12 +137,12 @@ fn write_all_and_update() { // 2 - Send the settings let json = json!([ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)", "dsc(rank)", ]); @@ -167,12 +174,12 @@ fn write_all_and_update() { // 4 - Update all settings let json_update = json!([ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)", ]); @@ -199,12 +206,12 @@ fn write_all_and_update() { let res_value: Value = serde_json::from_slice(&buf).unwrap(); let res_expected = json!([ - "_typo", - "_words", - "_proximity", - "_attribute", - "_words_position", - "_exactness", + "typo", + "words", + "proximity", + "attribute", + "words_position", + "exactness", "dsc(release_date)", ]);