From 2780e365e279c8ce94aaeae905fde8e7b8452150 Mon Sep 17 00:00:00 2001 From: jiangbo212 Date: Wed, 21 Dec 2022 14:31:45 +0800 Subject: [PATCH] test update and ndjson serde use from_slice --- meilisearch-types/src/document_formats.rs | 2 +- meilisearch/tests/documents/add_documents.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meilisearch-types/src/document_formats.rs b/meilisearch-types/src/document_formats.rs index 127cf41be..7a98dc0a3 100644 --- a/meilisearch-types/src/document_formats.rs +++ b/meilisearch-types/src/document_formats.rs @@ -156,7 +156,7 @@ pub fn read_ndjson(file: &File, writer: impl Write + Seek) -> Result { let mut builder = DocumentsBatchBuilder::new(writer); 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))?; builder.append_json_object(&object).map_err(Into::into).map_err(DocumentFormatError::Io)?; } diff --git a/meilisearch/tests/documents/add_documents.rs b/meilisearch/tests/documents/add_documents.rs index ffe8ee788..86cc819fa 100644 --- a/meilisearch/tests/documents/add_documents.rs +++ b/meilisearch/tests/documents/add_documents.rs @@ -741,7 +741,7 @@ async fn add_larger_dataset() { // x-ndjson add large test let server = Server::new().await; 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; assert_eq!(code, 200); assert_eq!(response["status"], "succeeded");