mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 00:31:02 +00:00
global settings update make partial update; fix #516
This commit is contained in:
@ -644,7 +644,6 @@ fn search_with_settings_basic() {
|
||||
"desc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"primaryKey": "id",
|
||||
"searchableAttributes": [
|
||||
"title",
|
||||
"tagline",
|
||||
@ -751,7 +750,6 @@ fn search_with_settings_stop_words() {
|
||||
"desc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"primaryKey": "id",
|
||||
"searchableAttributes": [
|
||||
"title",
|
||||
"tagline",
|
||||
@ -858,7 +856,6 @@ fn search_with_settings_synonyms() {
|
||||
"desc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"primaryKey": "id",
|
||||
"searchableAttributes": [
|
||||
"title",
|
||||
"tagline",
|
||||
@ -970,7 +967,6 @@ fn search_with_settings_ranking_rules() {
|
||||
"desc(popularity)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"primaryKey": "id",
|
||||
"searchableAttributes": [
|
||||
"title",
|
||||
"tagline",
|
||||
@ -1077,7 +1073,6 @@ fn search_with_settings_searchable_attributes() {
|
||||
"desc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"primaryKey": "id",
|
||||
"searchableAttributes": [
|
||||
"tagline",
|
||||
"overview",
|
||||
@ -1183,7 +1178,6 @@ fn search_with_settings_displayed_attributes() {
|
||||
"desc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"primaryKey": "id",
|
||||
"searchableAttributes": [
|
||||
"title",
|
||||
"tagline",
|
||||
@ -1254,7 +1248,6 @@ fn search_with_settings_searchable_attributes_2() {
|
||||
"desc(vote_average)"
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"primaryKey": "id",
|
||||
"searchableAttributes": [
|
||||
"tagline",
|
||||
"overview",
|
||||
|
@ -192,6 +192,7 @@ fn write_all_and_update() {
|
||||
"exactness",
|
||||
"desc(release_date)",
|
||||
],
|
||||
"distinctAttribute": null,
|
||||
"searchableAttributes": [
|
||||
"title",
|
||||
"description",
|
||||
@ -204,8 +205,7 @@ fn write_all_and_update() {
|
||||
"rank",
|
||||
"poster",
|
||||
],
|
||||
"stopWords": [
|
||||
],
|
||||
"stopWords": [],
|
||||
"synonyms": {
|
||||
"wolverine": ["xmen", "logan"],
|
||||
"logan": ["wolverine", "xmen"],
|
||||
@ -321,3 +321,111 @@ fn test_default_settings_2() {
|
||||
|
||||
assert_json_eq!(body, response, ordered: false);
|
||||
}
|
||||
|
||||
// Test issue https://github.com/meilisearch/MeiliSearch/issues/516
|
||||
#[test]
|
||||
fn write_setting_and_update_partial() {
|
||||
let mut server = common::Server::with_uid("movies");
|
||||
let body = json!({
|
||||
"uid": "movies",
|
||||
});
|
||||
server.create_index(body);
|
||||
|
||||
// 2 - Send the settings
|
||||
|
||||
let body = json!({
|
||||
"searchableAttributes": [
|
||||
"uid",
|
||||
"movie_id",
|
||||
"title",
|
||||
"description",
|
||||
"poster",
|
||||
"release_date",
|
||||
"rank",
|
||||
],
|
||||
"displayedAttributes": [
|
||||
"title",
|
||||
"description",
|
||||
"poster",
|
||||
"release_date",
|
||||
"rank",
|
||||
]
|
||||
});
|
||||
|
||||
server.update_all_settings(body.clone());
|
||||
|
||||
// 2 - Send the settings
|
||||
|
||||
let body = json!({
|
||||
"rankingRules": [
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"wordsPosition",
|
||||
"exactness",
|
||||
"desc(release_date)",
|
||||
"desc(rank)",
|
||||
],
|
||||
"distinctAttribute": "movie_id",
|
||||
"stopWords": [
|
||||
"the",
|
||||
"a",
|
||||
"an",
|
||||
],
|
||||
"synonyms": {
|
||||
"wolverine": ["xmen", "logan"],
|
||||
"logan": ["wolverine"],
|
||||
},
|
||||
"acceptNewFields": false,
|
||||
});
|
||||
|
||||
server.update_all_settings(body.clone());
|
||||
|
||||
// 2 - Send the settings
|
||||
|
||||
let expected = json!({
|
||||
"rankingRules": [
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
"attribute",
|
||||
"wordsPosition",
|
||||
"exactness",
|
||||
"desc(release_date)",
|
||||
"desc(rank)",
|
||||
],
|
||||
"distinctAttribute": "movie_id",
|
||||
"searchableAttributes": [
|
||||
"uid",
|
||||
"movie_id",
|
||||
"title",
|
||||
"description",
|
||||
"poster",
|
||||
"release_date",
|
||||
"rank",
|
||||
],
|
||||
"displayedAttributes": [
|
||||
"title",
|
||||
"description",
|
||||
"poster",
|
||||
"release_date",
|
||||
"rank",
|
||||
],
|
||||
"stopWords": [
|
||||
"the",
|
||||
"a",
|
||||
"an",
|
||||
],
|
||||
"synonyms": {
|
||||
"wolverine": ["xmen", "logan"],
|
||||
"logan": ["wolverine"],
|
||||
},
|
||||
"acceptNewFields": false,
|
||||
});
|
||||
|
||||
let (response, _status_code) = server.get_all_settings();
|
||||
|
||||
assert_json_eq!(expected, response, ordered: false);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user