mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
Only mark the first clear document with the amount of cleared documents
This commit is contained in:
parent
b24b13b036
commit
a083c9e452
@ -498,12 +498,19 @@ impl IndexScheduler {
|
|||||||
IndexOperation::DocumentClear { mut tasks, .. } => {
|
IndexOperation::DocumentClear { mut tasks, .. } => {
|
||||||
let count = milli::update::ClearDocuments::new(index_wtxn, index).execute()?;
|
let count = milli::update::ClearDocuments::new(index_wtxn, index).execute()?;
|
||||||
|
|
||||||
|
let mut first_clear_found = false;
|
||||||
for task in &mut tasks {
|
for task in &mut tasks {
|
||||||
task.status = Status::Succeeded;
|
task.status = Status::Succeeded;
|
||||||
|
// The first document clear will effectively delete every documents
|
||||||
|
// in the database but the next ones will clear 0 documents.
|
||||||
task.details = match &task.kind {
|
task.details = match &task.kind {
|
||||||
KindWithContent::DocumentClear { .. } => Some(Details::ClearAll {
|
KindWithContent::DocumentClear { .. } => {
|
||||||
deleted_documents: Some(count),
|
let count = if first_clear_found { 0 } else { count };
|
||||||
}),
|
first_clear_found = true;
|
||||||
|
Some(Details::ClearAll {
|
||||||
|
deleted_documents: Some(count),
|
||||||
|
})
|
||||||
|
}
|
||||||
otherwise => otherwise.default_details(),
|
otherwise => otherwise.default_details(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user