meilisearch/milli/src
meili-bors[bot] 29b44e5541
Merge #4626
4626: Edit Documents with Rhai r=ManyTheFish a=Kerollmops

This PR introduces a first version of [the _Update Documents with Function_ (internal)](https://www.notion.so/meilisearch/Update-Documents-by-Function-45f87b13e61c4435b73943768a490808). It uses [the Rhai programming language](https://rhai.rs/) to let users express the modifications they want apply.

You can read more about the way to use this functions on [the Usage PRD Page](https://meilisearch.notion.site/Edit-Documents-with-Rhai-0cff8fea7655436592e7c8a6de932062?pvs=25). The [prototype is available](https://github.com/meilisearch/meilisearch/actions/runs/9038384483) through Docker by using the following command:

```
docker run -p 7700:7700 -v $(pwd)/meili_data:/meili_data getmeili/meilisearch:prototype-edit-documents-with-rhai-3
```

## TODO
 - [x] Support the `DocumentEdition` task in dumps.
 - [x] Remove the unwraps and panics.
 - [x] Improve error codes for the `function` parameter.
 - [x] [Update Rhai to v1.19.0](https://github.com/rhaiscript/rhai/releases/tag/v1.19.0) 🚀
 - [x] Make it an experimental feature (only restrict the HTTP calls).
 - [x] It must be possible not to send a context.
 - [x] Rebase on main.
 - [x] Check that the script cannot do any io.
 - [x] ~Introduce a `Documents.edit` action or~ require the `Documents.all` action.
 - [x] Change the `editionCode` to the clearer `function` field name in the tasks.
 - [x] Support a user provided context and maybe more (but keep function execution isolated for reproducibility).
 - [x] Support deleting documents when the `doc` is `()` (nil, null).
 - [x] Support canceling document edition.
 - [x] Multithread document edition by using rayon (and [rayon-par-bridge](https://docs.rs/rayon-par-bridge/latest/rayon_par_bridge/)).
 - [x] Limit the number of instruction by function execution.
 - [ ] ~Expose the limit of instructions in the settings.~ Not sure, in fact.
 - [x] Ignore unmodified documents in the tasks count.
 - [x] Make the `filter` field optional (not forced to be `null`).

Co-authored-by: Clément Renault <clement@meilisearch.com>
2024-07-11 09:02:55 +00:00
..
documents Make milli use edition 2021 (#4770) 2024-07-09 17:25:39 +02:00
facet Make milli use edition 2021 (#4770) 2024-07-09 17:25:39 +02:00
heed_codec Merge #4786 2024-07-10 13:23:54 +00:00
prompt Remove prompt strategy and fallback 2023-12-14 16:08:41 +01:00
search We do not do intersections with the universe when it is related to cache 2024-07-10 16:49:36 +02:00
snapshots/index.rs always push the user defined vectors in arroy 2024-06-06 11:39:29 +02:00
update Apply review comments 2024-07-11 11:00:27 +02:00
vector Make milli use edition 2021 (#4770) 2024-07-09 17:25:39 +02:00
asc_desc.rs fmt 2023-03-30 23:37:26 +02:00
criterion.rs update the syntax of the geoboundingbox filter to uses brackets instead of parens around lat and lng 2023-02-06 16:50:27 +01:00
error.rs Create errors for the internal processing ones 2024-07-10 16:29:18 +02:00
external_documents_ids.rs Make milli use edition 2021 (#4770) 2024-07-09 17:25:39 +02:00
fieldids_weights_map.rs makes clippy and fmt happy 2024-06-06 11:39:29 +02:00
fields_ids_map.rs provide a method to get all the nested fields ids from a name 2024-06-06 11:36:11 +02:00
index.rs Merge #4786 2024-07-10 13:23:54 +00:00
lib.rs Check the Rhai syntax before accepting the script 2024-07-10 16:28:13 +02:00
order_by_map.rs Revert "Revert "Merge remote-tracking branch 'origin/main' into release-v1.7.1"" 2024-03-20 10:08:28 +01:00
proximity.rs Change the naming of attributeScale and wordScale into byAttribute and byWord 2023-12-14 16:31:00 +01:00
score_details.rs Breaking change: remove vector for score details 2024-04-04 15:57:29 +02:00
snapshot_tests.rs Make milli use edition 2021 (#4770) 2024-07-09 17:25:39 +02:00
thread_pool_no_abort.rs Introduce the ThreadPoolNoAbort wrapper 2024-04-24 16:40:12 +02:00