cms icon indicating copy to clipboard operation
cms copied to clipboard

Search doesn't consider taxonomy terms with localized fields

Open beliven-emanuele-bertoldi opened this issue 1 year ago • 8 comments

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

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

duncanmcclean avatar Apr 02 '24 10:04 duncanmcclean

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

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?

duncanmcclean avatar Apr 03 '24 12:04 duncanmcclean

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.

Oh, you're using entries, not taxonomies?

duncanmcclean avatar Apr 05 '24 14:04 duncanmcclean

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

github-actions[bot] avatar Jun 05 '24 01:06 github-actions[bot]

Sorry @duncanmcclean, not sure what you mean.

  • We're using a taxonomy called "category" with some propagated attributes to all sites.
  • We're relating entries in a collection "products" to the terms of the "category" taxonomy.
  • We're searching entries in the "products" collection by typing a term of the "category" taxonomy.
  • The problem is that typing a propagated term as search query on a site different than the default language doesn't return results as it does on the default site.

Hope this could better clarify the issue.

Thanks for your support!

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

github-actions[bot] avatar Aug 05 '24 01:08 github-actions[bot]

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

github-actions[bot] avatar Oct 05 '24 02:10 github-actions[bot]