diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index c9deedb37..5260a9d7e 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -1534,18 +1534,6 @@ fn delete_document_by_filter<'a>( } e => e.into(), })?; - let external_documents_ids = index.external_documents_ids(); - // FIXME: for filters matching a lot of documents, this will allocate a huge vec of external docids (strings). - // Since what we have is an iterator, it would be better to delete in chunks - let external_to_internal: std::result::Result, RoaringBitmap> = - external_documents_ids - .find_external_id_of(wtxn, candidates)? - .only_external_ids() - .collect(); - let document_ids = match external_to_internal { - Ok(external_ids) => external_ids, - Err(remaining_ids) => panic!("Couldn't find some external ids {:?}", remaining_ids), - }; let config = IndexDocumentsConfig { update_method: IndexDocumentsMethod::ReplaceDocuments, @@ -1561,13 +1549,10 @@ fn delete_document_by_filter<'a>( || must_stop_processing.get(), )?; - let (new_builder, user_result) = builder.remove_documents(document_ids)?; + let (new_builder, count) = builder.remove_documents_from_db_no_batch(&candidates)?; builder = new_builder; - // Uses Invariant: remove documents actually always returns Ok for the inner result - let count = user_result.unwrap(); let _ = builder.execute()?; - count } else { 0