mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 08:41:00 +00:00
Apply review comments
This commit is contained in:
@ -216,11 +216,11 @@ where
|
||||
let mut documents_batch_builder = tempfile::tempfile().map(DocumentsBatchBuilder::new)?;
|
||||
let mut documents_to_remove = RoaringBitmap::new();
|
||||
|
||||
let context: Dynamic = match context {
|
||||
let context: Option<Dynamic> = match context {
|
||||
Some(context) => {
|
||||
serde_json::from_value(context.into()).map_err(InternalError::SerdeJson)?
|
||||
Some(serde_json::from_value(context.into()).map_err(InternalError::SerdeJson)?)
|
||||
}
|
||||
None => Dynamic::from(()),
|
||||
None => None,
|
||||
};
|
||||
|
||||
enum DocumentEdition {
|
||||
@ -244,7 +244,9 @@ where
|
||||
let document_id = &json_document[primary_key];
|
||||
|
||||
let mut scope = Scope::new();
|
||||
scope.push_constant_dynamic("context", context.clone());
|
||||
if let Some(context) = context.as_ref().cloned() {
|
||||
scope.push_constant_dynamic("context", context.clone());
|
||||
}
|
||||
scope.push("doc", rhai_document);
|
||||
// That's were the magic happens. We run the user script
|
||||
// which edits "doc" scope variable reprensenting the document
|
||||
|
@ -60,7 +60,7 @@ impl<'t> ImmutableObkvs<'t> {
|
||||
let name = self.fields_ids_map.name(id).ok_or(
|
||||
crate::error::FieldIdMapMissingEntry::FieldId {
|
||||
field_id: id,
|
||||
process: "allobkv_to_rhaimap",
|
||||
process: "all_obkv_to_rhaimap",
|
||||
},
|
||||
)?;
|
||||
let value = serde_json::from_slice(value)
|
||||
|
Reference in New Issue
Block a user