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

search endpoint returns duplicated results for translated products #2197

Closed
tschortsch opened this issue May 26, 2023 · 6 comments
Closed

search endpoint returns duplicated results for translated products #2197

tschortsch opened this issue May 26, 2023 · 6 comments
Assignees
Labels
type: bug 🐛 Something isn't working @vendure/core

Comments

@tschortsch
Copy link
Contributor

Describe the bug
When I translate an existing product to another language the search endpoint (shop-api as well as admin-api) returns the translated product variants in both languages in the items field. This only happens when the languageCode param is set to another language than the default language. This behavior is also visible in the Admin UI when the Group by product switch is deactivated in the product list.

To Reproduce
Steps to reproduce the behavior:

  1. Enable multiple languages in 'Global settings'
  2. Go to 'Catalog > Products'
  3. Edit an existing product and translate it to another language
  4. Go to 'Catalog > Products' again and select a non-default language in the locale switcher
  5. Disable the 'Group by product' switch

Expected behavior
You should only see the product variants in the selected language

Environment (please complete the following information):

  • @vendure/core version: 2.0.0-beta.2
  • Nodejs version: 18
  • Database (mysql/postgres etc): sqlite
@tschortsch tschortsch added the type: bug 🐛 Something isn't working label May 26, 2023
@WeAreHaus
Copy link

WeAreHaus commented Sep 28, 2023

We are running Vendure 2.0.5 and are also experiencing issues with duplicated products when using search. It happens regardless if we use the langCode param and regardless of which language is set as default. We have about 400 products translated into both Swedish and English and use paginated queries to fetch them (12 at a time).

Sometimes, one of the products on the next page is the same as the products on the previous page - i.e. the same product is fetched twice but on different pages. This seems to be an issue when the product name is identical or the price is identical. We tried to sort by name, then price or price, then name, but to no avail.

The instance is running the DefaultSearchPlugin, if that makes any difference.

When do you think it's possible to have a fix for this bug?

Environment

  • Vendure 2.0.5
  • Node v18
  • MySQL

@michaelbromley
Copy link
Member

@WeAreHaus I just put this on the backlog to take a look at for the next patch release.

If you are able to set up a minimal reproduction repo, it would make it about 10x more likely that I can get a fix for that patch :)

@WeAreHaus
Copy link

Great, thank you!

We managed to solve it by loading all products into the browser and do the pagination there instead. I'm a little pressed for time at the moment but will try to create a reproduction repo soon.

@busyfingers
Copy link

Hi @michaelbromley

I have created a reproduction repo for this issue here: https://github.com/WeAreHaus/reproduction-vendure-issue-2197
(I'm the previous poster, just posting from a different account this time) :)

I haven't been able to reproduce the duplicated first and last product when paginating the results using the Vendure demo data. Unfortunately I cannot share the actual data we use but I will continue to look into that part, and maybe it should also be a different issue.

Let me know if you need any more information. Thank you in advance!

@michaelbromley
Copy link
Member

@busyfingers thank you for the reproduction! Looking into this now...

@michaelbromley
Copy link
Member

I believe this is the same issue that is addressed in this PR:

@michaelbromley michaelbromley moved this from 📋 Backlog to ✅ Done in Vendure OS Roadmap Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working @vendure/core
Projects
Status: 🚀 Shipped
Development

No branches or pull requests

4 participants