mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
Use it from delete-by-filter
This commit is contained in:
parent
3053e01c05
commit
f8289cd974
@ -1534,18 +1534,6 @@ fn delete_document_by_filter<'a>(
|
|||||||
}
|
}
|
||||||
e => e.into(),
|
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<Vec<_>, 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 {
|
let config = IndexDocumentsConfig {
|
||||||
update_method: IndexDocumentsMethod::ReplaceDocuments,
|
update_method: IndexDocumentsMethod::ReplaceDocuments,
|
||||||
@ -1561,13 +1549,10 @@ fn delete_document_by_filter<'a>(
|
|||||||
|| must_stop_processing.get(),
|
|| 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;
|
builder = new_builder;
|
||||||
// Uses Invariant: remove documents actually always returns Ok for the inner result
|
|
||||||
let count = user_result.unwrap();
|
|
||||||
|
|
||||||
let _ = builder.execute()?;
|
let _ = builder.execute()?;
|
||||||
|
|
||||||
count
|
count
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
|
Loading…
Reference in New Issue
Block a user