mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-11 07:28:56 +01:00
test update and ndjson serde use from_slice
This commit is contained in:
parent
bf2a401a05
commit
2780e365e2
@ -156,7 +156,7 @@ pub fn read_ndjson(file: &File, writer: impl Write + Seek) -> Result<u64> {
|
|||||||
let mut builder = DocumentsBatchBuilder::new(writer);
|
let mut builder = DocumentsBatchBuilder::new(writer);
|
||||||
let mmap = unsafe { MmapOptions::new().map(file)? };
|
let mmap = unsafe { MmapOptions::new().map(file)? };
|
||||||
|
|
||||||
for result in serde_json::Deserializer::from_reader(mmap.as_ref()).into_iter() {
|
for result in serde_json::Deserializer::from_slice(&mmap).into_iter() {
|
||||||
let object = result.map_err(Error::Json).map_err(|e| (PayloadType::Ndjson, e))?;
|
let object = result.map_err(Error::Json).map_err(|e| (PayloadType::Ndjson, e))?;
|
||||||
builder.append_json_object(&object).map_err(Into::into).map_err(DocumentFormatError::Io)?;
|
builder.append_json_object(&object).map_err(Into::into).map_err(DocumentFormatError::Io)?;
|
||||||
}
|
}
|
||||||
|
@ -741,7 +741,7 @@ async fn add_larger_dataset() {
|
|||||||
// x-ndjson add large test
|
// x-ndjson add large test
|
||||||
let server = Server::new().await;
|
let server = Server::new().await;
|
||||||
let index = server.index("test");
|
let index = server.index("test");
|
||||||
let update_id = index.load_test_set().await;
|
let update_id = index.load_test_set_ndjson().await;
|
||||||
let (response, code) = index.get_task(update_id).await;
|
let (response, code) = index.get_task(update_id).await;
|
||||||
assert_eq!(code, 200);
|
assert_eq!(code, 200);
|
||||||
assert_eq!(response["status"], "succeeded");
|
assert_eq!(response["status"], "succeeded");
|
||||||
|
Loading…
Reference in New Issue
Block a user