mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
Merge #444
444: Fix the parsing of ndjson requests to index more than the first line r=Kerollmops a=Kerollmops This PR correctly uses the `BufRead` trait to read every line of the content instead of just the first one. This bug was only affecting the http-ui test crate. Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
commit
2468ebb76b
@ -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 documents = milli::documents::DocumentBatchBuilder::new(&mut writer)?;
|
||||
|
||||
let mut buf = String::new();
|
||||
let mut reader = BufReader::new(reader);
|
||||
|
||||
while reader.read_line(&mut buf)? > 0 {
|
||||
documents.extend_from_json(&mut buf.as_bytes())?;
|
||||
for result in BufReader::new(reader).lines() {
|
||||
let line = result?;
|
||||
documents.extend_from_json(Cursor::new(line))?;
|
||||
}
|
||||
|
||||
documents.finish()?;
|
||||
|
||||
Ok(writer.into_inner())
|
||||
|
Loading…
Reference in New Issue
Block a user