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 doesn't consider taxonomy terms with localized fields #9803

Open
beliven-emanuele-bertoldi opened this issue Apr 2, 2024 · 5 comments

Comments

@beliven-emanuele-bertoldi
Copy link

beliven-emanuele-bertoldi commented Apr 2, 2024

Bug description

  • We have a site with several languages.
  • We have a "news" collection with a "category" taxonomy.
  • The "Category" taxonomy has a title and a description attributes.
  • Entries in the "news" collection have untranslated, propagated attributes.
  • Searching on a site with a different language by a taxonomy term in default language doesn't return linked items.

How to reproduce

  • Create a site multi-language
  • Create a "category" taxonomy with a title and a description attribute
  • Set the "propagate" flag to all taxonomy attributes
  • Change search config including an index by taxonomy title and description attributes
  • Create a category with a description in the default language
  • Choose a custom language different by the default one
  • Search by category description typing it in default language

Logs

No response

Environment

Statamic 4.52
PHP 8.1
Laravel 10.8

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

None

Additional details

No response

@duncanmcclean
Copy link
Member

Just to clarify, are you talking about the Control Panel search or the search on the frontend with the {{ search:results }} tag?

@beliven-emanuele-bertoldi
Copy link
Author

beliven-emanuele-bertoldi commented Apr 2, 2024

@duncanmcclean the search on the frontend with the {{ search:results }} tag

@duncanmcclean duncanmcclean changed the title Search doesn't consider taxonomy terms with propagated attributes Search doesn't consider taxonomy terms with localized fields Apr 3, 2024
@duncanmcclean
Copy link
Member

I've tried to replicate this issue locally, but everything seems to be working fine for me 🤔

Although, it's possible I'm misunderstanding the reproduction steps you provided... is this what you're doing?

  1. Creating a new category term with title & description fields in the default site.
  2. Then, on the right-hand side, clicking on another site to localize the term.
  3. Using the {{ search:results }} tag on your frontend to search for text in the category description.

In my testing site, I have a term with two localizations - English & German. The description of my English localization contains the word Coffee and my German localization contains the word Kaffee.

When I search in my English site, Coffee returns the term but Kaffee doesn't. Then, when I search in my German site, Kaffee returns the term but Coffee doesn't.

Is that accurate? Are you expecting it to work differently?

@beliven-emanuele-bertoldi
Copy link
Author

Hi @duncanmcclean , thanks for your feedback!

Our use case involves the use of propagation (https://statamic.dev/tips/localizing-entries#propagation), so using untranslated (propagated) content during search on sites with different language.

So, based on your example, it would be like having the description Coffee in English and propagated as-is to German and then searching for Coffee on the german site.

@duncanmcclean
Copy link
Member

Oh, you're using entries, not taxonomies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants