Add delete_document_using_wtxn to TempIndex

This commit is contained in:
Louis Dureuil 2023-10-26 12:15:55 +02:00
parent 652ac3052d
commit ae4ec8ea55
No known key found for this signature in database

View File

@ -1526,11 +1526,13 @@ pub(crate) mod tests {
Ok(()) Ok(())
} }
pub fn delete_documents(&self, external_document_ids: Vec<String>) { pub fn delete_documents_using_wtxn<'t>(
let mut wtxn = self.write_txn().unwrap(); &'t self,
wtxn: &mut RwTxn<'t, '_>,
external_document_ids: Vec<String>,
) {
let builder = IndexDocuments::new( let builder = IndexDocuments::new(
&mut wtxn, wtxn,
self, self,
&self.indexer_config, &self.indexer_config,
self.index_documents_config.clone(), self.index_documents_config.clone(),
@ -1541,6 +1543,12 @@ pub(crate) mod tests {
let (builder, user_error) = builder.remove_documents(external_document_ids).unwrap(); let (builder, user_error) = builder.remove_documents(external_document_ids).unwrap();
user_error.unwrap(); user_error.unwrap();
builder.execute().unwrap(); builder.execute().unwrap();
}
pub fn delete_documents(&self, external_document_ids: Vec<String>) {
let mut wtxn = self.write_txn().unwrap();
self.delete_documents_using_wtxn(&mut wtxn, external_document_ids);
wtxn.commit().unwrap(); wtxn.commit().unwrap();
} }