medusajs / medusa

Building blocks for digital commerce
https://medusajs.com
MIT License
24.86k stars 2.48k forks source link

Product variant entities of a product indexed by meilisearch do not contain the same fields as for example the "raw product" output #5910

Open genox opened 9 months ago

genox commented 9 months ago

Bug report

I noticed that the document generated for indexing with meilisearch using the official meilisearch plugin misses attributes that are present when requesting the document via regular API.

Pricing attributes and attributes added by plugins (for example variant-images) are not part of the entity that is being indexed.

System information

Medusa version (including plugins) are all latest as of writing the issue

Steps to reproduce the behavior

index all attributes as displayable by meilisearch look at the indexed documents variants and notice the missing price field or the missing images.

Expected behavior

I expect that the same document with the same fields is indexable as is served via regular API calls.

Screenshots

variant in index

Screenshot 2023-12-17 at 17 37 12

variant in admin ui

Screenshot 2023-12-17 at 17 38 06

As you can see, the list of attributes is not identical.

genox commented 9 months ago

A workaround is to fetch a variant when displaying the content to get the correct attributes. The store I am working on allows to choose variants in the overview list, so that will cause a lot of additional requests that could be prevented by having a properly indexed document.