mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-05 04:28:55 +01:00
Fix the parsing of ndjson requests to index more than the first line
This commit is contained in:
parent
38d23546a5
commit
9142ba9dd4
@ -1063,12 +1063,11 @@ fn documents_from_jsonl(reader: impl io::Read) -> anyhow::Result<Vec<u8>> {
|
|||||||
let mut writer = Cursor::new(Vec::new());
|
let mut writer = Cursor::new(Vec::new());
|
||||||
let mut documents = milli::documents::DocumentBatchBuilder::new(&mut writer)?;
|
let mut documents = milli::documents::DocumentBatchBuilder::new(&mut writer)?;
|
||||||
|
|
||||||
let mut buf = String::new();
|
for result in BufReader::new(reader).lines() {
|
||||||
let mut reader = BufReader::new(reader);
|
let line = result?;
|
||||||
|
documents.extend_from_json(Cursor::new(line))?;
|
||||||
while reader.read_line(&mut buf)? > 0 {
|
|
||||||
documents.extend_from_json(&mut buf.as_bytes())?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
documents.finish()?;
|
documents.finish()?;
|
||||||
|
|
||||||
Ok(writer.into_inner())
|
Ok(writer.into_inner())
|
||||||
|
Loading…
Reference in New Issue
Block a user