remove one useless txn

This commit is contained in:
Tamo 2023-04-06 17:12:43 +02:00 committed by Louis Dureuil
parent 3680a6bf1e
commit 6df2ba93a9
No known key found for this signature in database

View File

@ -1489,10 +1489,9 @@ impl IndexScheduler {
fn delete_document_by_filter(filter: &serde_json::Value, index: Index) -> Result<u64> { fn delete_document_by_filter(filter: &serde_json::Value, index: Index) -> Result<u64> {
let filter = Filter::from_json(filter)?; let filter = Filter::from_json(filter)?;
Ok(if let Some(filter) = filter { Ok(if let Some(filter) = filter {
let index_rtxn = index.read_txn()?;
let candidates = filter.evaluate(&index_rtxn, &index)?;
let mut wtxn = index.write_txn()?; let mut wtxn = index.write_txn()?;
let candidates = filter.evaluate(&wtxn, &index)?;
let mut delete_operation = DeleteDocuments::new(&mut wtxn, &index)?; let mut delete_operation = DeleteDocuments::new(&mut wtxn, &index)?;
delete_operation.delete_documents(&candidates); delete_operation.delete_documents(&candidates);
let deleted_documents = let deleted_documents =