mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-25 22:34:28 +01:00
Rename editionCode to function
This commit is contained in:
parent
f4add93043
commit
f32e6c32fc
@ -1411,28 +1411,27 @@ impl IndexScheduler {
|
|||||||
Ok(tasks)
|
Ok(tasks)
|
||||||
}
|
}
|
||||||
IndexOperation::DocumentEdition { mut task, .. } => {
|
IndexOperation::DocumentEdition { mut task, .. } => {
|
||||||
let (filter, edition_code) =
|
let (filter, function) =
|
||||||
if let KindWithContent::DocumentEdition { filter_expr, edition_code, .. } =
|
if let KindWithContent::DocumentEdition { filter_expr, function, .. } =
|
||||||
&task.kind
|
&task.kind
|
||||||
{
|
{
|
||||||
(filter_expr, edition_code)
|
(filter_expr, function)
|
||||||
} else {
|
} else {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
};
|
};
|
||||||
let edited_documents = edit_documents_by_function(
|
let edited_documents = edit_documents_by_function(
|
||||||
index_wtxn,
|
index_wtxn,
|
||||||
filter,
|
filter,
|
||||||
edition_code,
|
function,
|
||||||
self.index_mapper.indexer_config(),
|
self.index_mapper.indexer_config(),
|
||||||
self.must_stop_processing.clone(),
|
self.must_stop_processing.clone(),
|
||||||
index,
|
index,
|
||||||
);
|
);
|
||||||
let (original_filter, edition_code) =
|
let (original_filter, function) =
|
||||||
if let Some(Details::DocumentEdition {
|
if let Some(Details::DocumentEdition { original_filter, function, .. }) =
|
||||||
original_filter, edition_code, ..
|
task.details
|
||||||
}) = task.details
|
|
||||||
{
|
{
|
||||||
(original_filter, edition_code)
|
(original_filter, function)
|
||||||
} else {
|
} else {
|
||||||
// In the case of a `documentDeleteByFilter` the details MUST be set
|
// In the case of a `documentDeleteByFilter` the details MUST be set
|
||||||
unreachable!();
|
unreachable!();
|
||||||
@ -1443,7 +1442,7 @@ impl IndexScheduler {
|
|||||||
task.status = Status::Succeeded;
|
task.status = Status::Succeeded;
|
||||||
task.details = Some(Details::DocumentEdition {
|
task.details = Some(Details::DocumentEdition {
|
||||||
original_filter,
|
original_filter,
|
||||||
edition_code,
|
function,
|
||||||
edited_documents: Some(edited_documents),
|
edited_documents: Some(edited_documents),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1451,7 +1450,7 @@ impl IndexScheduler {
|
|||||||
task.status = Status::Failed;
|
task.status = Status::Failed;
|
||||||
task.details = Some(Details::DocumentEdition {
|
task.details = Some(Details::DocumentEdition {
|
||||||
original_filter,
|
original_filter,
|
||||||
edition_code,
|
function,
|
||||||
edited_documents: Some(0),
|
edited_documents: Some(0),
|
||||||
});
|
});
|
||||||
task.error = Some(e.into());
|
task.error = Some(e.into());
|
||||||
|
@ -179,10 +179,10 @@ fn snapshot_details(d: &Details) -> String {
|
|||||||
}
|
}
|
||||||
Details::DocumentEdition {
|
Details::DocumentEdition {
|
||||||
edited_documents,
|
edited_documents,
|
||||||
edition_code,
|
function,
|
||||||
original_filter,
|
original_filter,
|
||||||
} => {
|
} => {
|
||||||
format!("{{ edited_documents: {edited_documents:?}, edition_code: {edition_code:?}, original_filter: {original_filter:?} }}")
|
format!("{{ edited_documents: {edited_documents:?}, function: {function:?}, original_filter: {original_filter:?} }}")
|
||||||
}
|
}
|
||||||
Details::SettingsUpdate { settings } => {
|
Details::SettingsUpdate { settings } => {
|
||||||
format!("{{ settings: {settings:?} }}")
|
format!("{{ settings: {settings:?} }}")
|
||||||
|
@ -72,7 +72,7 @@ pub struct DetailsView {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub dump_uid: Option<Option<String>>,
|
pub dump_uid: Option<Option<String>>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub edition_code: Option<String>,
|
pub function: Option<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub settings: Option<Box<Settings<Unchecked>>>,
|
pub settings: Option<Box<Settings<Unchecked>>>,
|
||||||
@ -90,11 +90,11 @@ impl From<Details> for DetailsView {
|
|||||||
..DetailsView::default()
|
..DetailsView::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Details::DocumentEdition { edited_documents, original_filter, edition_code } => {
|
Details::DocumentEdition { edited_documents, original_filter, function } => {
|
||||||
DetailsView {
|
DetailsView {
|
||||||
edited_documents: Some(edited_documents),
|
edited_documents: Some(edited_documents),
|
||||||
original_filter: Some(original_filter),
|
original_filter: Some(original_filter),
|
||||||
edition_code: Some(edition_code),
|
function: Some(function),
|
||||||
..DetailsView::default()
|
..DetailsView::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ pub enum KindWithContent {
|
|||||||
DocumentEdition {
|
DocumentEdition {
|
||||||
index_uid: String,
|
index_uid: String,
|
||||||
filter_expr: Option<serde_json::Value>,
|
filter_expr: Option<serde_json::Value>,
|
||||||
edition_code: String,
|
function: String,
|
||||||
},
|
},
|
||||||
DocumentDeletion {
|
DocumentDeletion {
|
||||||
index_uid: String,
|
index_uid: String,
|
||||||
@ -211,11 +211,11 @@ impl KindWithContent {
|
|||||||
indexed_documents: None,
|
indexed_documents: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
KindWithContent::DocumentEdition { index_uid: _, edition_code, filter_expr } => {
|
KindWithContent::DocumentEdition { index_uid: _, function, filter_expr } => {
|
||||||
Some(Details::DocumentEdition {
|
Some(Details::DocumentEdition {
|
||||||
edited_documents: None,
|
edited_documents: None,
|
||||||
original_filter: filter_expr.as_ref().map(|v| v.to_string()),
|
original_filter: filter_expr.as_ref().map(|v| v.to_string()),
|
||||||
edition_code: edition_code.clone(),
|
function: function.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
KindWithContent::DocumentDeletion { index_uid: _, documents_ids } => {
|
KindWithContent::DocumentDeletion { index_uid: _, documents_ids } => {
|
||||||
@ -266,11 +266,11 @@ impl KindWithContent {
|
|||||||
indexed_documents: Some(0),
|
indexed_documents: Some(0),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
KindWithContent::DocumentEdition { index_uid: _, filter_expr, edition_code } => {
|
KindWithContent::DocumentEdition { index_uid: _, filter_expr, function } => {
|
||||||
Some(Details::DocumentEdition {
|
Some(Details::DocumentEdition {
|
||||||
edited_documents: Some(0),
|
edited_documents: Some(0),
|
||||||
original_filter: filter_expr.as_ref().map(|v| v.to_string()),
|
original_filter: filter_expr.as_ref().map(|v| v.to_string()),
|
||||||
edition_code: edition_code.clone(),
|
function: function.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
KindWithContent::DocumentDeletion { index_uid: _, documents_ids } => {
|
KindWithContent::DocumentDeletion { index_uid: _, documents_ids } => {
|
||||||
@ -531,7 +531,7 @@ pub enum Details {
|
|||||||
DocumentEdition {
|
DocumentEdition {
|
||||||
edited_documents: Option<u64>,
|
edited_documents: Option<u64>,
|
||||||
original_filter: Option<String>,
|
original_filter: Option<String>,
|
||||||
edition_code: String,
|
function: String,
|
||||||
},
|
},
|
||||||
SettingsUpdate {
|
SettingsUpdate {
|
||||||
settings: Box<Settings<Unchecked>>,
|
settings: Box<Settings<Unchecked>>,
|
||||||
|
@ -613,7 +613,7 @@ pub async fn edit_documents_by_function(
|
|||||||
.map_err(|err| ResponseError::from_msg(err.message, Code::InvalidDocumentFilter))?;
|
.map_err(|err| ResponseError::from_msg(err.message, Code::InvalidDocumentFilter))?;
|
||||||
}
|
}
|
||||||
let task =
|
let task =
|
||||||
KindWithContent::DocumentEdition { index_uid, filter_expr: filter, edition_code: function };
|
KindWithContent::DocumentEdition { index_uid, filter_expr: filter, function: function };
|
||||||
|
|
||||||
let uid = get_task_id(&req, &opt)?;
|
let uid = get_task_id(&req, &opt)?;
|
||||||
let dry_run = is_dry_run(&req, &opt)?;
|
let dry_run = is_dry_run(&req, &opt)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user