Join GitHub today
Normalizing keywords for search index uses wrong language #3046
The keywords for the search index are obviousliy built depending on the current users cp language. That should use the language of the site the entry is in.
Using Craft::$app->language in craft\helpers\Search
Steps to reproduce
I’m not able to reproduce this. I created a Craft install with two sites (EN and DE) with EN being the primary. Then created a section enabled for both sites, and created a new entry with DE selected, title = “Zauberflöte”. As expected the entry will show up in search results for “Zauberflöte” regardless of which site is selected.
Here is the
Let me know if you can think of any other variables that could be affecting this on your site. If you’re not sure, please send your
Thanks, but that's not the use case i tried to describe, sorry that my description was misleading.
It's about the language the author selected for his personal use in the backend.
So, if a user has this preferences:
and saves the item, the table shows:
If you change the preferences to this:
and resave the entry, the table content is:
and that is what works with this search in the german site:
In helpers/Search.php line 88 there is
// This will replace accented chars with non-accented chars $map = StringHelper::asciiCharMap(true, Craft::$app->language);
where, if i don't get it wrong,
I could find a temporary workaround with some configuration settings
'customAsciiCharMappingss' => [ 'a' => ['ä', 'Ä'], 'o' => ['ö', 'Ö'], 'u' => ['ü', 'Ü'], 's' => ['ß'] ],
but there might be some unwanted side effects (?), and it's deprecated anyway.
Thanks again for your efforts, the multilingual feature was one of the main reasons our clients switched from another wellknown CMS to Craft.