mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-17 08:10:14 +08:00
Merge pull request #572 from ppamorim/ignore-null-nested-obj
Add support of nested null
This commit is contained in:
commit
065da3d613
@ -3,3 +3,4 @@
|
|||||||
- Add the number of hits in search result (#541)
|
- Add the number of hits in search result (#541)
|
||||||
- Add support for aligned crop in search result (#543)
|
- Add support for aligned crop in search result (#543)
|
||||||
- Sanitize the content displayed in the web interface (#539)
|
- Sanitize the content displayed in the web interface (#539)
|
||||||
|
- Add support of nested null and boolean values (#571 and #568)
|
||||||
|
@ -88,7 +88,7 @@ impl ser::Serializer for ConvertToString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_unit(self) -> Result<Self::Ok, Self::Error> {
|
fn serialize_unit(self) -> Result<Self::Ok, Self::Error> {
|
||||||
Err(SerializerError::UnserializableType { type_name: "()" })
|
Ok(String::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_unit_struct(self, _name: &'static str) -> Result<Self::Ok, Self::Error> {
|
fn serialize_unit_struct(self, _name: &'static str) -> Result<Self::Ok, Self::Error> {
|
||||||
|
@ -76,3 +76,38 @@ fn check_add_documents_with_nested_boolean() {
|
|||||||
assert_eq!(status_code, 200);
|
assert_eq!(status_code, 200);
|
||||||
assert_eq!(response["status"], "processed");
|
assert_eq!(response["status"], "processed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test issue https://github.com/meilisearch/MeiliSearch/issues/571
|
||||||
|
#[test]
|
||||||
|
fn check_add_documents_with_nested_null() {
|
||||||
|
let mut server = common::Server::with_uid("tasks");
|
||||||
|
|
||||||
|
// 1 - Create the index with no primary_key
|
||||||
|
|
||||||
|
let body = json!({ "uid": "tasks" });
|
||||||
|
let (response, status_code) = server.create_index(body);
|
||||||
|
assert_eq!(status_code, 201);
|
||||||
|
assert_eq!(response["primaryKey"], json!(null));
|
||||||
|
|
||||||
|
// 2 - Add a document that contains a null in a nested object
|
||||||
|
|
||||||
|
let body = json!([{
|
||||||
|
"id": 0,
|
||||||
|
"foo": {
|
||||||
|
"bar": null
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
let url = "/indexes/tasks/documents";
|
||||||
|
let (response, status_code) = server.post_request(&url, body);
|
||||||
|
eprintln!("{:#?}", response);
|
||||||
|
assert_eq!(status_code, 202);
|
||||||
|
let update_id = response["updateId"].as_u64().unwrap();
|
||||||
|
server.wait_update_id(update_id);
|
||||||
|
|
||||||
|
// 3 - Check update sucess
|
||||||
|
|
||||||
|
let (response, status_code) = server.get_update_status(update_id);
|
||||||
|
assert_eq!(status_code, 200);
|
||||||
|
assert_eq!(response["status"], "processed");
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user