Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algolia not indexing relation field, only shows count #139

Open
rbsam176 opened this issue Dec 16, 2022 · 4 comments
Open

Algolia not indexing relation field, only shows count #139

rbsam176 opened this issue Dec 16, 2022 · 4 comments

Comments

@rbsam176
Copy link

rbsam176 commented Dec 16, 2022

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:

  • Guide
  • Category

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
Copy link

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

@philohelp
Copy link

philohelp commented Jan 6, 2023

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
Copy link

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

@shadow1349
Copy link

also noticed the same

parsagholipour added a commit to parsagholipour/mattie-strapi-bundle that referenced this issue Jan 21, 2023
It will allow to populate relations before sending it to provider
Example usage:
```
contentTypes: [
    { name: 'api::post.post', populate: ['tags'] }
],
```
MattieBelt#139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants