mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-25 19:45:05 +08:00
Count the number of documents correctly
This commit is contained in:
parent
23f0c2c29b
commit
2c7a7fe4e8
@ -58,7 +58,6 @@ impl<'pl> DocumentOperation<'pl> {
|
|||||||
|
|
||||||
for operation in operations {
|
for operation in operations {
|
||||||
let mut bytes = 0;
|
let mut bytes = 0;
|
||||||
let mut document_count = 0;
|
|
||||||
let result = match operation {
|
let result = match operation {
|
||||||
Payload::Addition(payload) => extract_addition_payload_changes(
|
Payload::Addition(payload) => extract_addition_payload_changes(
|
||||||
indexer,
|
indexer,
|
||||||
@ -69,7 +68,6 @@ impl<'pl> DocumentOperation<'pl> {
|
|||||||
new_fields_ids_map,
|
new_fields_ids_map,
|
||||||
&mut available_docids,
|
&mut available_docids,
|
||||||
&mut bytes,
|
&mut bytes,
|
||||||
&mut document_count,
|
|
||||||
&docids_version_offsets,
|
&docids_version_offsets,
|
||||||
method,
|
method,
|
||||||
payload,
|
payload,
|
||||||
@ -78,7 +76,6 @@ impl<'pl> DocumentOperation<'pl> {
|
|||||||
index,
|
index,
|
||||||
rtxn,
|
rtxn,
|
||||||
&mut available_docids,
|
&mut available_docids,
|
||||||
&mut document_count,
|
|
||||||
&docids_version_offsets,
|
&docids_version_offsets,
|
||||||
method,
|
method,
|
||||||
to_delete,
|
to_delete,
|
||||||
@ -96,7 +93,11 @@ impl<'pl> DocumentOperation<'pl> {
|
|||||||
Err(e) => return Err(e),
|
Err(e) => return Err(e),
|
||||||
};
|
};
|
||||||
|
|
||||||
operations_stats.push(PayloadStats { document_count, bytes, error });
|
operations_stats.push(PayloadStats {
|
||||||
|
document_count: docids_version_offsets.len() as u64,
|
||||||
|
bytes,
|
||||||
|
error,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO We must drain the HashMap into a Vec because rayon::hash_map::IntoIter: !Clone
|
// TODO We must drain the HashMap into a Vec because rayon::hash_map::IntoIter: !Clone
|
||||||
@ -128,7 +129,6 @@ fn extract_addition_payload_changes<'r, 'pl: 'r>(
|
|||||||
new_fields_ids_map: &mut FieldsIdsMap,
|
new_fields_ids_map: &mut FieldsIdsMap,
|
||||||
available_docids: &mut AvailableIds,
|
available_docids: &mut AvailableIds,
|
||||||
bytes: &mut u64,
|
bytes: &mut u64,
|
||||||
number_of_documents: &mut u64,
|
|
||||||
main_docids_version_offsets: &hashbrown::HashMap<&'pl str, PayloadOperations<'pl>>,
|
main_docids_version_offsets: &hashbrown::HashMap<&'pl str, PayloadOperations<'pl>>,
|
||||||
method: MergeMethod,
|
method: MergeMethod,
|
||||||
payload: &'pl [u8],
|
payload: &'pl [u8],
|
||||||
@ -140,7 +140,6 @@ fn extract_addition_payload_changes<'r, 'pl: 'r>(
|
|||||||
let mut iter = Deserializer::from_slice(payload).into_iter::<&RawValue>();
|
let mut iter = Deserializer::from_slice(payload).into_iter::<&RawValue>();
|
||||||
while let Some(doc) = iter.next().transpose().map_err(InternalError::SerdeJson)? {
|
while let Some(doc) = iter.next().transpose().map_err(InternalError::SerdeJson)? {
|
||||||
*bytes = previous_offset as u64;
|
*bytes = previous_offset as u64;
|
||||||
*number_of_documents = new_docids_version_offsets.len() as u64;
|
|
||||||
|
|
||||||
// Only guess the primary key if it is the first document
|
// Only guess the primary key if it is the first document
|
||||||
let retrieved_primary_key = if previous_offset == 0 {
|
let retrieved_primary_key = if previous_offset == 0 {
|
||||||
@ -238,7 +237,6 @@ fn extract_deletion_payload_changes<'s, 'pl: 's>(
|
|||||||
index: &Index,
|
index: &Index,
|
||||||
rtxn: &RoTxn,
|
rtxn: &RoTxn,
|
||||||
available_docids: &mut AvailableIds,
|
available_docids: &mut AvailableIds,
|
||||||
number_of_documents: &mut u64,
|
|
||||||
main_docids_version_offsets: &hashbrown::HashMap<&'s str, PayloadOperations<'pl>>,
|
main_docids_version_offsets: &hashbrown::HashMap<&'s str, PayloadOperations<'pl>>,
|
||||||
method: MergeMethod,
|
method: MergeMethod,
|
||||||
to_delete: &'pl [&'pl str],
|
to_delete: &'pl [&'pl str],
|
||||||
@ -287,7 +285,6 @@ fn extract_deletion_payload_changes<'s, 'pl: 's>(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
*number_of_documents += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(new_docids_version_offsets)
|
Ok(new_docids_version_offsets)
|
||||||
|
Loading…
Reference in New Issue
Block a user