mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
Add a comment about the ClearDocuments operation in the DeleteDocuments
This commit is contained in:
parent
98fc24cbdf
commit
1228c2948d
@ -264,9 +264,7 @@ pub fn run(opt: Opt) -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let meta = match result {
|
let meta = match result {
|
||||||
Ok(()) => format!("valid update content"),
|
Ok(()) => format!("valid update content"),
|
||||||
Err(e) => {
|
Err(e) => format!("error while processing update content: {:?}", e),
|
||||||
format!("error while processing update content: {}", e)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let processed = UpdateStatus::Processed { update_id, meta: meta.clone() };
|
let processed = UpdateStatus::Processed { update_id, meta: meta.clone() };
|
||||||
|
@ -57,6 +57,11 @@ impl<'t, 'u, 'i> DeleteDocuments<'t, 'u, 'i> {
|
|||||||
documents_ids.intersect_with(&self.documents_ids);
|
documents_ids.intersect_with(&self.documents_ids);
|
||||||
self.index.put_documents_ids(self.wtxn, &documents_ids)?;
|
self.index.put_documents_ids(self.wtxn, &documents_ids)?;
|
||||||
|
|
||||||
|
// TODO we should be able to execute a ClearDocuments operation when the number of documents
|
||||||
|
// to delete is exactly the number of documents in the database, however it seems that
|
||||||
|
// clearing a database in LMDB requires a commit for it to be effective, we can't clear
|
||||||
|
// and assume that the database is empty in the same wtxn or something.
|
||||||
|
|
||||||
let fields_ids_map = self.index.fields_ids_map(self.wtxn)?;
|
let fields_ids_map = self.index.fields_ids_map(self.wtxn)?;
|
||||||
let id_field = fields_ids_map.id("id").expect(r#"the field "id" to be present"#);
|
let id_field = fields_ids_map.id("id").expect(r#"the field "id" to be present"#);
|
||||||
|
|
||||||
|
@ -398,6 +398,8 @@ impl<'t, 'u, 'i> IndexDocuments<'t, 'u, 'i> {
|
|||||||
WriteMethod::Append
|
WriteMethod::Append
|
||||||
};
|
};
|
||||||
|
|
||||||
|
debug!("Writing using the write method: {:?}", write_method);
|
||||||
|
|
||||||
// We write the fields ids map into the main database
|
// We write the fields ids map into the main database
|
||||||
self.index.put_fields_ids_map(self.wtxn, &fields_ids_map)?;
|
self.index.put_fields_ids_map(self.wtxn, &fields_ids_map)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user