mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
test distinct attribute
This commit is contained in:
parent
8035ca7138
commit
3d771f2289
@ -469,3 +469,19 @@ async fn setting_ranking_rules_dont_mess_with_other_settings() {
|
||||
assert!(!response["searchableAttributes"].as_array().unwrap().iter().any(|e| e.as_str().unwrap() == "foobar"));
|
||||
assert!(!response["displayedAttributes"].as_array().unwrap().iter().any(|e| e.as_str().unwrap() == "foobar"));
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn distinct_attribute_recorded_as_known_field() {
|
||||
let mut server = common::Server::test_server().await;
|
||||
let body = json!({
|
||||
"distinctAttribute": "foobar",
|
||||
"acceptNewFields": true
|
||||
});
|
||||
server.update_all_settings(body).await;
|
||||
let document = json!([{"id": 9348127, "foobar": "hello", "foo": "bar"}]);
|
||||
server.add_or_update_multiple_documents(document).await;
|
||||
// foobar should not be added to the searchable attributes because it is already known, but "foo" should
|
||||
let (response, _) = server.get_all_settings().await;
|
||||
assert!(response["searchableAttributes"].as_array().unwrap().iter().any(|v| v.as_str().unwrap() == "foo"));
|
||||
assert!(!response["searchableAttributes"].as_array().unwrap().iter().any(|v| v.as_str().unwrap() == "foobar"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user