## Context Meilisearch introduced [document relations](https://www.meilisearch.com/docs/capabilities/indexing/joins/define_index_relationships) as an experimental feature. ## Objective Add support for the document relations settings as an experimental feature. Experimental features should require opt-in by the user. Read the [how to guide](https://www.meilisearch.com/docs/capabilities/indexing/how_to/document_relations) for more information. ## Tasks - [ ] Add methods to interact with [Get foreignKeys](https://www.meilisearch.com/docs/reference/api/settings/get-foreignkeys), [Update foreignKeys](https://www.meilisearch.com/docs/reference/api/settings/update-foreignkeys), and [Reset foreignKeys](https://www.meilisearch.com/docs/reference/api/settings/reset-foreignkeys) API endpoints - [ ] Update the global settings methods to accept and handle the `foreignKeys` setting - [ ] Add a `MeiliForeignOperatorExpression` to the filter builder that generates `_foreign(foreignIndexUid, filter)` expressions - [ ] Add test cases for all new methods - [ ] Add code samples in `.code-samples.meilisearch.yaml` matching the Meilisearch documentation CURL examples: - [ ] Under `get_foreign_keys_setting_1`: equivalent of [this code sample](https://github.com/meilisearch/documentation/blob/ea674f4b86c52675c7996d817ec1b339c164dcff/.code-samples.meilisearch.yaml#L1607-L1609) - [ ] Under `update_foreign_keys_setting_1`: equivalent of [this code sample](https://github.com/meilisearch/documentation/blob/ea674f4b86c52675c7996d817ec1b339c164dcff/.code-samples.meilisearch.yaml#L1611-L1624) - [ ] Under `reset_foreign_keys_setting_1`: equivalent of [this code sample](https://github.com/meilisearch/documentation/blob/ea674f4b86c52675c7996d817ec1b339c164dcff/.code-samples.meilisearch.yaml#L1626-L1628) ## Resources Release notes: - [Meilisearch v1.39](https://github.com/meilisearch/meilisearch/releases/tag/v1.39.0) introduced **cross-index document hydration** via a new `foreignKeys` index setting. This allows linking documents across indexes so that search results are automatically enriched with related data. - [Meilisearch v1.42](https://github.com/meilisearch/meilisearch/releases/tag/v1.42.0) extended it with **document join filtering** — the ability to filter search results using the `_foreign()` filter syntax on related indexes. This requires the foreign key field to also be configured in `filterableAttributes`. - [Meilisearch v1.48](https://github.com/meilisearch/meilisearch/releases/tag/v1.48.0) refined it by restricting foreign filters to retrieval routes only.