From e755e2584719d51fa922b30fd7faa0e2e79961f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 16 Apr 2025 22:52:54 +0200 Subject: [PATCH] Use the script in the edit documents --- .../src/update/new/indexer/document_operation.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/milli/src/update/new/indexer/document_operation.rs b/crates/milli/src/update/new/indexer/document_operation.rs index 766dcb32e..17428f735 100644 --- a/crates/milli/src/update/new/indexer/document_operation.rs +++ b/crates/milli/src/update/new/indexer/document_operation.rs @@ -159,15 +159,8 @@ impl<'pl> DocumentOperation<'pl> { let docids_version_offsets = docids_version_offsets.into_bump_slice(); let engine = rhai::Engine::new(); - let ast = Some( - r#" - let incr = doc.remove("incr_likes"); - if incr != () { - doc.likes = (doc.likes ?? 0) + incr; - } - "#, - ) - .map(|f| engine.compile(f).unwrap()); + // Make sure to correctly setup the engine and remove all settings + let ast = index.execute_after_update(rtxn)?.map(|f| engine.compile(f).unwrap()); let fidmap = index.fields_ids_map(rtxn)?; Ok((