mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
Skip reading empty lines in NDJson update file
This commit is contained in:
parent
b7724c65b8
commit
1d9caa11fd
@ -100,6 +100,10 @@ pub fn read_ndjson(mut input: impl BufRead, writer: impl Write + Seek) -> Result
|
|||||||
let mut builder = DocumentsBatchBuilder::new(writer);
|
let mut builder = DocumentsBatchBuilder::new(writer);
|
||||||
let mut buf = String::with_capacity(1024);
|
let mut buf = String::with_capacity(1024);
|
||||||
while input.read_line(&mut buf)? > 0 {
|
while input.read_line(&mut buf)? > 0 {
|
||||||
|
if buf == "\n" {
|
||||||
|
buf.clear();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
builder
|
builder
|
||||||
.append_unparsed_json_object(&buf)
|
.append_unparsed_json_object(&buf)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
|
Loading…
Reference in New Issue
Block a user