mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Use raw JSON to read the payloads
This commit is contained in:
parent
8412be4a7d
commit
72c6a21a30
5 changed files with 131 additions and 94 deletions
|
@ -459,12 +459,13 @@ async fn document_addition(
|
|||
return Err(MeilisearchHttpError::Payload(ReceivePayload(Box::new(e))));
|
||||
}
|
||||
|
||||
let read_file = buffer.into_inner().into_std().await;
|
||||
let mut read_file = buffer.into_inner().into_std().await;
|
||||
let documents_count = tokio::task::spawn_blocking(move || {
|
||||
let documents_count = match format {
|
||||
PayloadType::Json => read_json(&read_file, &mut update_file)?,
|
||||
PayloadType::Csv { delimiter } => read_csv(&read_file, &mut update_file, delimiter)?,
|
||||
PayloadType::Ndjson => read_ndjson(&read_file, &mut update_file)?,
|
||||
/// TODO do not copy all the content
|
||||
PayloadType::Ndjson => std::io::copy(&mut read_file, &mut update_file).unwrap(),
|
||||
};
|
||||
// we NEED to persist the file here because we moved the `udpate_file` in another task.
|
||||
update_file.persist()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue