test update and ndjson serde use from_slice

This commit is contained in:
jiangbo212 2022-12-21 14:31:45 +08:00
parent bf2a401a05
commit 2780e365e2
2 changed files with 2 additions and 2 deletions

View File

@ -156,7 +156,7 @@ pub fn read_ndjson(file: &File, writer: impl Write + Seek) -> Result<u64> {
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)?;
}

View File

@ -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");