You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
427: Add populateEntryRule in plugin's settings r=bidoubiwa a=bidoubiwa
Fixes: #423Fixes: #425
By default when fetching an entry from the Strapi database it will not always fetch every nested relationship.
Imagine I have a collection that has a relationship with another collection, that itself has another relationship etc..
when fetching with `findOne` for example it will not go as deep.
this PR introduces a setting that lets the user give the specific rule to provide to the fetching method to ensure that every nested relation is fetched how the user would like it.
Co-authored-by: Charlotte Vermandel <[email protected]>
Co-authored-by: cvermand <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -350,6 +350,60 @@ module.exports = {
350
350
351
351
[See resources](./resources/meilisearch-settings) for more settings examples.
352
352
353
+
#### 👥 Populate entry rule
354
+
355
+
Content-types in Strapi may have relationships with other content-types (ex: `restaurant` can have a many-to-many relation with `category`). To ensure that these links are fetched and added to an entry correctly from your Strapi database, the correct populate rule must be provided ([see documentation](https://docs-next.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/entity-service/populate.html#basic-populating)).
356
+
357
+
To communicate the populate rule, use the `populateEntryRule` setting on the according content-type in the plugin's settings.
358
+
359
+
**For example**
360
+
361
+
Imagine my `restaurant` content-type has a relation with a repeatable-component `repeatableComponent` that itself has a relationship with the content-type `categories`.
362
+
363
+
The following population will ensure that a `restaurant` entry contains even the most nested relation.
by providing this, the following is indexed in Meilisearch:
378
+
379
+
```json
380
+
{
381
+
"id": "restaurant-1",
382
+
"title": "The slimmy snail",
383
+
// ... other restaurant fields
384
+
"repeatableComponent": [
385
+
{
386
+
"id": 1,
387
+
"title": "my repeatable component 1"
388
+
"categories": [
389
+
{
390
+
"id": 3,
391
+
"name": "Asian",
392
+
// ... other category fields
393
+
},
394
+
{
395
+
"id": 2,
396
+
"name": "Healthy",
397
+
// ... other category fields
398
+
}
399
+
],
400
+
401
+
}
402
+
],
403
+
404
+
}
405
+
```
406
+
353
407
### 🕵️♀️ Start Searching <!-- omit in toc -->
354
408
355
409
Once you have a content-type indexed in Meilisearch, you can [start searching](https://docs.meilisearch.com/learn/getting_started/quick_start.html#search).
0 commit comments