Support DocumentEdition in dumps

This commit is contained in:
Clément Renault 2024-07-04 15:52:10 +02:00
parent f35d6710f3
commit bcd0c5f5a4
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
3 changed files with 29 additions and 19 deletions

View File

@ -104,6 +104,11 @@ pub enum KindDump {
DocumentDeletionByFilter { DocumentDeletionByFilter {
filter: serde_json::Value, filter: serde_json::Value,
}, },
DocumentEdition {
filter: Option<serde_json::Value>,
context: Option<serde_json::Map<String, serde_json::Value>>,
function: String,
},
Settings { Settings {
settings: Box<meilisearch_types::settings::Settings<Unchecked>>, settings: Box<meilisearch_types::settings::Settings<Unchecked>>,
is_deletion: bool, is_deletion: bool,
@ -166,18 +171,15 @@ impl From<KindWithContent> for KindDump {
documents_count, documents_count,
allow_index_creation, allow_index_creation,
}, },
KindWithContent::DocumentEdition { .. } => KindDump::DocumentImport {
primary_key: None,
method: IndexDocumentsMethod::UpdateDocuments,
documents_count: 0,
allow_index_creation: false,
},
KindWithContent::DocumentDeletion { documents_ids, .. } => { KindWithContent::DocumentDeletion { documents_ids, .. } => {
KindDump::DocumentDeletion { documents_ids } KindDump::DocumentDeletion { documents_ids }
} }
KindWithContent::DocumentDeletionByFilter { filter_expr, .. } => { KindWithContent::DocumentDeletionByFilter { filter_expr, .. } => {
KindDump::DocumentDeletionByFilter { filter: filter_expr } KindDump::DocumentDeletionByFilter { filter: filter_expr }
} }
KindWithContent::DocumentEdition { filter_expr, context, function, .. } => {
KindDump::DocumentEdition { filter: filter_expr, context, function }
}
KindWithContent::DocumentClear { .. } => KindDump::DocumentClear, KindWithContent::DocumentClear { .. } => KindDump::DocumentClear,
KindWithContent::SettingsUpdate { KindWithContent::SettingsUpdate {
new_settings, new_settings,

View File

@ -1603,6 +1603,14 @@ impl<'a> Dump<'a> {
index_uid: task.index_uid.ok_or(Error::CorruptedDump)?, index_uid: task.index_uid.ok_or(Error::CorruptedDump)?,
} }
} }
KindDump::DocumentEdition { filter, context, function } => {
KindWithContent::DocumentEdition {
index_uid: task.index_uid.ok_or(Error::CorruptedDump)?,
filter_expr: filter,
context,
function,
}
}
KindDump::DocumentClear => KindWithContent::DocumentClear { KindDump::DocumentClear => KindWithContent::DocumentClear {
index_uid: task.index_uid.ok_or(Error::CorruptedDump)?, index_uid: task.index_uid.ok_or(Error::CorruptedDump)?,
}, },

View File

@ -97,12 +97,6 @@ pub enum KindWithContent {
documents_count: u64, documents_count: u64,
allow_index_creation: bool, allow_index_creation: bool,
}, },
DocumentEdition {
index_uid: String,
filter_expr: Option<serde_json::Value>,
context: Option<milli::Object>,
function: String,
},
DocumentDeletion { DocumentDeletion {
index_uid: String, index_uid: String,
documents_ids: Vec<String>, documents_ids: Vec<String>,
@ -111,6 +105,12 @@ pub enum KindWithContent {
index_uid: String, index_uid: String,
filter_expr: serde_json::Value, filter_expr: serde_json::Value,
}, },
DocumentEdition {
index_uid: String,
filter_expr: Option<serde_json::Value>,
context: Option<milli::Object>,
function: String,
},
DocumentClear { DocumentClear {
index_uid: String, index_uid: String,
}, },
@ -534,13 +534,6 @@ pub enum Details {
received_documents: u64, received_documents: u64,
indexed_documents: Option<u64>, indexed_documents: Option<u64>,
}, },
DocumentEdition {
deleted_documents: Option<u64>,
edited_documents: Option<u64>,
original_filter: Option<String>,
context: Option<Object>,
function: String,
},
SettingsUpdate { SettingsUpdate {
settings: Box<Settings<Unchecked>>, settings: Box<Settings<Unchecked>>,
}, },
@ -555,6 +548,13 @@ pub enum Details {
original_filter: String, original_filter: String,
deleted_documents: Option<u64>, deleted_documents: Option<u64>,
}, },
DocumentEdition {
deleted_documents: Option<u64>,
edited_documents: Option<u64>,
original_filter: Option<String>,
context: Option<Object>,
function: String,
},
ClearAll { ClearAll {
deleted_documents: Option<u64>, deleted_documents: Option<u64>,
}, },