From 2c38f9bedb9fb80599343654b0de98a56369504f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 19 Nov 2024 15:17:46 +0100 Subject: [PATCH] Correctly count indexed documents --- crates/milli/src/update/new/indexer/document_operation.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/milli/src/update/new/indexer/document_operation.rs b/crates/milli/src/update/new/indexer/document_operation.rs index 99de461a4..51a52cf8b 100644 --- a/crates/milli/src/update/new/indexer/document_operation.rs +++ b/crates/milli/src/update/new/indexer/document_operation.rs @@ -82,8 +82,10 @@ impl<'pl> DocumentOperation<'pl> { ), }; + let mut document_count = 0; let error = match result { Ok(new_docids_version_offsets) => { + document_count = new_docids_version_offsets.len() as u64; // If we don't have any error then we can merge the content of this payload // into to main payload. Else we just drop this payload extraction. merge_version_offsets(&mut docids_version_offsets, new_docids_version_offsets); @@ -93,11 +95,7 @@ impl<'pl> DocumentOperation<'pl> { Err(e) => return Err(e), }; - operations_stats.push(PayloadStats { - document_count: docids_version_offsets.len() as u64, - bytes, - error, - }); + operations_stats.push(PayloadStats { document_count, bytes, error }); } // TODO We must drain the HashMap into a Vec because rayon::hash_map::IntoIter: !Clone