Use the script in the edit documents

This commit is contained in:
Clément Renault 2025-04-16 22:52:54 +02:00
parent 81419935f2
commit e755e25847
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -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((