handle the array of array form of filter in the dumps

This commit is contained in:
Tamo 2023-05-02 22:36:56 +02:00 committed by Louis Dureuil
parent fc8c1d118d
commit 0f0cd2d929
No known key found for this signature in database
3 changed files with 3 additions and 9 deletions

View File

@ -102,7 +102,7 @@ pub enum KindDump {
},
DocumentClear,
DocumentDeletionByFilter {
filter: String,
filter: serde_json::Value,
},
Settings {
settings: Box<meilisearch_types::settings::Settings<Unchecked>>,
@ -170,7 +170,7 @@ impl From<KindWithContent> for KindDump {
KindDump::DocumentDeletion { documents_ids }
}
KindWithContent::DocumentDeletionByFilter { filter_expr, .. } => {
KindDump::DocumentDeletionByFilter { filter: filter_expr.to_string() }
KindDump::DocumentDeletionByFilter { filter: filter_expr }
}
KindWithContent::DocumentClear { .. } => KindDump::DocumentClear,
KindWithContent::SettingsUpdate {

View File

@ -1210,8 +1210,7 @@ impl<'a> Dump<'a> {
},
KindDump::DocumentDeletionByFilter { filter } => {
KindWithContent::DocumentDeletionByFilter {
filter_expr: serde_json::from_str(&filter)
.map_err(|_| Error::CorruptedDump)?,
filter_expr: filter,
index_uid: task.index_uid.ok_or(Error::CorruptedDump)?,
}
}

View File

@ -83,11 +83,6 @@ impl Task {
}
}
pub enum DocumentDeletionContent {
ByDocumentIds(Vec<String>),
ByFilter(serde_json::Value),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum KindWithContent {