mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
Apply review comments
This commit is contained in:
parent
837274f853
commit
6e80364c50
5 changed files with 14 additions and 8 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue