Skip reading empty lines in NDJson update file

This commit is contained in:
Loïc Lecrenier 2022-07-04 14:31:31 +02:00
parent b7724c65b8
commit 1d9caa11fd

View File

@ -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 buf = String::with_capacity(1024);
while input.read_line(&mut buf)? > 0 {
if buf == "\n" {
buf.clear();
continue;
}
builder
.append_unparsed_json_object(&buf)
.map_err(Into::into)