mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Support filtering the documents to edit with lua
This commit is contained in:
parent
1702b5cf44
commit
ba85959642
5 changed files with 153 additions and 17 deletions
|
@ -90,11 +90,14 @@ impl From<Details> for DetailsView {
|
|||
..DetailsView::default()
|
||||
}
|
||||
}
|
||||
Details::DocumentEdition { edited_documents, edition_code } => DetailsView {
|
||||
edited_documents: Some(edited_documents),
|
||||
edition_code: Some(edition_code),
|
||||
..DetailsView::default()
|
||||
},
|
||||
Details::DocumentEdition { edited_documents, original_filter, edition_code } => {
|
||||
DetailsView {
|
||||
edited_documents: Some(edited_documents),
|
||||
original_filter: Some(Some(original_filter)),
|
||||
edition_code: Some(edition_code),
|
||||
..DetailsView::default()
|
||||
}
|
||||
}
|
||||
Details::SettingsUpdate { mut settings } => {
|
||||
settings.hide_secrets();
|
||||
DetailsView { settings: Some(settings), ..DetailsView::default() }
|
||||
|
|
|
@ -98,6 +98,7 @@ pub enum KindWithContent {
|
|||
},
|
||||
DocumentEdition {
|
||||
index_uid: String,
|
||||
filter_expr: serde_json::Value,
|
||||
edition_code: String,
|
||||
},
|
||||
DocumentDeletion {
|
||||
|
@ -210,9 +211,10 @@ impl KindWithContent {
|
|||
indexed_documents: None,
|
||||
})
|
||||
}
|
||||
KindWithContent::DocumentEdition { edition_code, .. } => {
|
||||
KindWithContent::DocumentEdition { index_uid: _, edition_code, filter_expr } => {
|
||||
Some(Details::DocumentEdition {
|
||||
edited_documents: None,
|
||||
original_filter: filter_expr.to_string(),
|
||||
edition_code: edition_code.clone(),
|
||||
})
|
||||
}
|
||||
|
@ -264,9 +266,10 @@ impl KindWithContent {
|
|||
indexed_documents: Some(0),
|
||||
})
|
||||
}
|
||||
KindWithContent::DocumentEdition { edition_code, .. } => {
|
||||
KindWithContent::DocumentEdition { index_uid: _, filter_expr, edition_code } => {
|
||||
Some(Details::DocumentEdition {
|
||||
edited_documents: Some(0),
|
||||
original_filter: filter_expr.to_string(),
|
||||
edition_code: edition_code.clone(),
|
||||
})
|
||||
}
|
||||
|
@ -321,12 +324,7 @@ impl From<&KindWithContent> for Option<Details> {
|
|||
indexed_documents: None,
|
||||
})
|
||||
}
|
||||
KindWithContent::DocumentEdition { edition_code, .. } => {
|
||||
Some(Details::DocumentEdition {
|
||||
edited_documents: None,
|
||||
edition_code: edition_code.clone(),
|
||||
})
|
||||
}
|
||||
KindWithContent::DocumentEdition { .. } => None,
|
||||
KindWithContent::DocumentDeletion { .. } => None,
|
||||
KindWithContent::DocumentDeletionByFilter { .. } => None,
|
||||
KindWithContent::DocumentClear { .. } => None,
|
||||
|
@ -527,7 +525,7 @@ impl std::error::Error for ParseTaskKindError {}
|
|||
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
|
||||
pub enum Details {
|
||||
DocumentAdditionOrUpdate { received_documents: u64, indexed_documents: Option<u64> },
|
||||
DocumentEdition { edited_documents: Option<u64>, edition_code: String },
|
||||
DocumentEdition { edited_documents: Option<u64>, original_filter: String, edition_code: String },
|
||||
SettingsUpdate { settings: Box<Settings<Unchecked>> },
|
||||
IndexInfo { primary_key: Option<String> },
|
||||
DocumentDeletion { provided_ids: usize, deleted_documents: Option<u64> },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue