MattieBelt / mattie-strapi-bundle

Mattie plugin bundle for Strapi
https://mattie-bundle.mattiebelt.com
MIT License
40 stars 19 forks source link

Algolia not indexing relation field, only shows count #139

Open rbsam176 opened 1 year ago

rbsam176 commented 1 year ago

I installed the Algolia x Strapi plugin today, everything went really smoothly except for one field. Here's my setup:

On Strapi, I have 2 collection types:

They have a relationship, so a category can belong to many guides.

image

When I publish a guide, Algolia seems to only index the count:

image

My plugins.js search object: search: { enabled: true, config: { provider: 'algolia', providerOptions: { apiKey: env('ALGOLIA_PROVIDER_ADMIN_API_KEY'), applicationId: env('ALGOLIA_PROVIDER_APPLICATION_ID'), }, contentTypes: [{ name: 'api::guide.guide' }], }, },

I've only ever used GraphQL to query Strapi, so I'm not familiar how to specify the content types (eg. api::guide.guide), only that it seems to match the URL in Strapi when viewing a collection type. Is this something to do with the Entity Service API? Does something need to be changed to make it work with relations?

EDIT: I've since learned that in order to make the REST API include relations you need to include a 'populate' parameter, is there something equivalent that can be entered into the contentTypes array in plugins.js?

alexanderscott commented 1 year ago

+1, nesting entity relational data into the algolia record payload would be very useful

philohelp commented 1 year ago

Yes relations were populated before but it seems that it is no longer the case. It is pretty annoying...

@MattieBelt any idea why this changed ?

sauldeleon commented 1 year ago

Hi, spotted the same issue here. Happening with array relationships, like for example, an array of categories belonging to the same post.

shadow1349 commented 1 year ago

also noticed the same