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 query doesn't work properly with localization and collectionSlug input #728

Closed
coderjib opened this issue Feb 24, 2021 · 4 comments
Closed
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@coderjib
Copy link
Contributor

Describe the bug
If a collection is configured for 2 or more languages with different slugs, if you perform a "search" query using shop api localized url (xx/shop-api?languageCode=en, for instance), it fails to find the products in that collection (which on turn are localized in both languages), as it seems to expect to always expect to receive the default language slug and not the localized one.
Replacing the collectionSlug with collectionId obviously fixes the issue and is a good workaround.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Vendure admin and configure 2 supported languages (e.g. italian main language, english secondary language)
  2. Create a new collection and configure different slugs for each language
  3. Associate at least one product to this collection and localize it for the 2 (or more) languages
  4. Go to the graphql playground with the languageCode=en parameter (where en is the secondary language)
  5. Perform a search query using the secondary language slug and see empty result

Expected behavior
Localized search query should "use" the localized collection slug

Environment (please complete the following information):

  • @vendure/core version: 0.18.3
  • Database (mysql/postgres etc): postgres
@coderjib coderjib added the type: bug 🐛 Something isn't working label Feb 24, 2021
@michaelbromley
Copy link
Member

michaelbromley commented Feb 26, 2021

Thanks for the report. I can reproduce this 👍 I believe it is caused by the fact that no event is being emitted when updating only the name/slug of the Collection, and therefore the search index is not getting updated. You can verify this by manually updating the search index (gear icon in product list view) and then seeing whether things work as expected.

@coderjib
Copy link
Contributor Author

coderjib commented Mar 9, 2021

I have just posted a comment on #712 describing my latest tests, as I guess both these issue are related to products search indexing

@Izayda
Copy link
Contributor

Izayda commented Oct 11, 2021

Is it actual? Probably this issue can be resolved

@michaelbromley
Copy link
Member

I agree, the recent fix you made would have handled this.

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
Projects
None yet
Development

No branches or pull requests

3 participants