SyliusElasticsearchPlugin icon indicating copy to clipboard operation
SyliusElasticsearchPlugin copied to clipboard

Cannot filter with taxons.code containing hyphens

Open 22116 opened this issue 1 year ago • 0 comments

Hello BitBag team,

Firstly, I want to express my appreciation for the excellent work you've done on this plugin. It's been a valuable asset to our project.

I've encountered an issue that seems to be affecting products containing hyphens in their taxons. When adding a new taxon to such products, they fail to appear on the taxon product list page. After some investigation, it appears that the problem lies in how Elasticsearch tokenizes words inside queries.

Upon reviewing the code, I believe the issue can be resolved by modifying the HasTaxonQueryBuilder to bypass the .keyword suffix in the $taxonQuery = new Terms($this->taxonsProperty); line. However, as I'm not an Elasticsearch expert, I'm unsure if this approach could have any performance implications or affect other functionalities within the plugin.

If there's a configuration option that I've overlooked which addresses this issue, please point me in the right direction.

Our environment details are as follows:

Sylius version: v1.12.13 Plugin version: v3.2.1 I would greatly appreciate your feedback on this matter and whether my proposed solution is viable. Additionally, if you'd like, I'm willing to contribute the fix to the plugin codebase.

Thank you in advance for your assistance.

22116 avatar Mar 07 '24 22:03 22116