Open HugoSEIGLE opened 1 week ago
Hi @HugoSEIGLE! Thank you for this report... with such a vision on the problem and where it occurs... would you maybe have time to submit a fix ? :)
Hi @HugoSEIGLE! Thank you for this report... with such a vision on the problem and where it occurs... would you maybe have time to submit a fix ? :)
Hi, it's done :)
Well.. thank you very much! 😄
(i will look at it after the week-end)
Description:
In the MyAutocompleteField implementation, the searchable_fields option includes translations.name and foo.translations.name. However, when both fields share the same name (name), the autocomplete search only uses the first occurrence (translations.name). If the order is reversed, the search instead targets foo.translations.name, which leads to inconsistent search results depending on the field order.
This behavior impacts the usability of the autocomplete functionality, as it prevents the search from working properly across both related entities.
Steps to reproduce:
Expected behavior:
The autocomplete should search across both translations.name and foo.translations.name fields, regardless of their order in searchable_fields.
Actual behavior:
The search query only considers the first occurrence of name in searchable_fields, ignoring the second field. Proposed Solution:
Consider updating the query logic to handle multiple fields with the same name explicitly. This could involve aliasing the fields or extending the searchable_fields handling to ensure both translations.name and foo.translations.name are included in the search query.
Environment:
Code :