mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
Introduce a function to extend from a JSON array of objects
This commit is contained in:
parent
dc61105554
commit
a892a4a79c
6 changed files with 89 additions and 12 deletions
|
@ -337,11 +337,8 @@ fn documents_from_jsonl(reader: impl Read) -> Result<Vec<u8>> {
|
|||
|
||||
fn documents_from_json(reader: impl Read) -> Result<Vec<u8>> {
|
||||
let mut documents = DocumentsBatchBuilder::new(Vec::new());
|
||||
let list: Vec<Object> = serde_json::from_reader(reader)?;
|
||||
|
||||
for object in list {
|
||||
documents.append_json_object(&object)?;
|
||||
}
|
||||
documents.append_json_array(reader)?;
|
||||
|
||||
documents.into_inner().map_err(Into::into)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue