mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
Fill an IndexDeletion task with the number of documents removed
This commit is contained in:
parent
6b3b05fb73
commit
566c15fb74
@ -462,15 +462,25 @@ impl IndexScheduler {
|
|||||||
mut tasks,
|
mut tasks,
|
||||||
} => {
|
} => {
|
||||||
let wtxn = self.env.write_txn()?;
|
let wtxn = self.env.write_txn()?;
|
||||||
|
|
||||||
|
let number_of_documents = {
|
||||||
|
let index = self.index_mapper.index(&wtxn, &index_uid)?;
|
||||||
|
let index_rtxn = index.read_txn()?;
|
||||||
|
index.number_of_documents(&index_rtxn)?
|
||||||
|
};
|
||||||
|
|
||||||
// The write transaction is directly owned and commited inside.
|
// The write transaction is directly owned and commited inside.
|
||||||
self.index_mapper.delete_index(wtxn, &index_uid)?;
|
self.index_mapper.delete_index(wtxn, &index_uid)?;
|
||||||
|
|
||||||
// We set all the tasks details to the default value.
|
// We set all the tasks details to the default value.
|
||||||
for task in &mut tasks {
|
for task in &mut tasks {
|
||||||
task.status = Status::Succeeded;
|
task.status = Status::Succeeded;
|
||||||
// TODO should we put a details = None, here?
|
task.details = match &task.kind {
|
||||||
// TODO we are putting Details::IndexInfo with a primary_key = None, this is not cool bro'
|
KindWithContent::IndexDeletion { .. } => Some(Details::ClearAll {
|
||||||
task.details = task.kind.default_details();
|
deleted_documents: Some(number_of_documents),
|
||||||
|
}),
|
||||||
|
otherwise => otherwise.default_details(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(tasks)
|
Ok(tasks)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user