implement delete document batches

This commit is contained in:
mpostma 2021-02-12 17:39:14 +01:00
parent a8ba809656
commit c317af58bc
No known key found for this signature in database
GPG key ID: CBC8A7C1D7A28C3A
5 changed files with 68 additions and 7 deletions

View file

@ -33,6 +33,7 @@ pub struct IndexMetadata {
pub enum UpdateMeta {
DocumentsAddition { method: IndexDocumentsMethod, format: UpdateFormat },
ClearDocuments,
DeleteDocuments,
Settings(Settings),
Facets(Facets),
}
@ -94,6 +95,7 @@ impl Settings {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum UpdateResult {
DocumentsAddition(DocumentAdditionResult),
DocumentDeletion { deleted: usize },
Other,
}
@ -131,6 +133,9 @@ pub trait IndexController {
/// Clear all documents in the given index.
fn clear_documents(&self, index: impl AsRef<str>) -> anyhow::Result<UpdateStatus>;
/// Clear all documents in the given index.
fn delete_documents(&self, index: impl AsRef<str>, document_ids: Vec<String>) -> anyhow::Result<UpdateStatus>;
/// Updates an index settings. If the index does not exist, it will be created when the update
/// is applied to the index.
fn update_settings<S: AsRef<str>>(&self, index_uid: S, settings: Settings) -> anyhow::Result<UpdateStatus>;