From 8aeeb4d172f1d668165ee66be7a66945c727a84c 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 f23540715..0a07ca9a2 100644 --- a/crates/milli/src/update/new/indexer/document_operation.rs +++ b/crates/milli/src/update/new/indexer/document_operation.rs @@ -164,15 +164,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((