Skip to content

Conversation

@tamvt
Copy link
Contributor

@tamvt tamvt commented Dec 10, 2025

This pull request introduces a configuration option to control whether the language analyzer should be used in Elasticsearch queries, and updates the codebase to respect this setting. The main change is the addition of the use_language_analyzer flag, which allows switching between the default language analyzer and a whitespace analyzer for search queries. The PR also ensures this configuration is properly passed through dependency injection, and adds tests to verify the new behavior.

Configuration and Dependency Injection:

  • Added a new boolean configuration option use_language_analyzer to Configuration.php and elasticsearch.yaml, with environment variable support for toggling its value. [1] [2] [3]
  • Passed the elasticsearch.use_language_analyzer parameter as a constructor argument in service definitions, ensuring it is available in relevant classes.

Query Builder Logic:

  • Updated TokenQueryBuilder to accept the useLanguageAnalyzer flag and conditionally set the analyzer to sw_whitespace_analyzer when the flag is disabled for both match and match phrase prefix queries. [1] [2]

@tamvt tamvt self-assigned this Dec 10, 2025
@tamvt tamvt linked an issue Dec 10, 2025 that may be closed by this pull request
@tamvt tamvt added the domain/inventory Responsible for managing products and everything product-related label Dec 10, 2025
@explore-openapi
Copy link

explore-openapi bot commented Dec 10, 2025

OpenAPI Snapshot

Project: shopware/store-api

No changes detected

Your OpenAPI schema is identical to the base branch (trunk).

Links:
All Project Snapshots · Base Branch Snapshot

Project: shopware/admin-api

No changes detected

Your OpenAPI schema is identical to the base branch (trunk).

Links:
All Project Snapshots · Base Branch Snapshot

@tamvt tamvt force-pushed the 13738-allow-disable-search-language-analyzer-via-env-variable branch from 1be5196 to b1a8dad Compare December 10, 2025 10:25
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.13%. Comparing base (7ef5a07) to head (37e8be8).
⚠️ Report is 1 commits behind head on trunk.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #13940   +/-   ##
=======================================
  Coverage   54.12%   54.13%           
=======================================
  Files        3203     3203           
  Lines       96384    96397   +13     
=======================================
+ Hits        52170    52180   +10     
- Misses      44214    44217    +3     
Flag Coverage Δ
phpunit-migration 92.92% <ø> (ø)
phpunit-unit 51.85% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tamvt tamvt force-pushed the 13738-allow-disable-search-language-analyzer-via-env-variable branch from b1a8dad to 37e8be8 Compare December 17, 2025 03:45
@tamvt tamvt requested a review from vienthuong December 17, 2025 04:28
@tamvt tamvt added this pull request to the merge queue Dec 17, 2025
Merged via the queue into trunk with commit ea40e09 Dec 17, 2025
67 checks passed
@tamvt tamvt deleted the 13738-allow-disable-search-language-analyzer-via-env-variable branch December 17, 2025 08:09
@github-actions github-actions bot added this to the 6.7.6.0 milestone Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/advanced-search component/search domain/inventory Responsible for managing products and everything product-related milestone/6.7.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow disable search language analyzer via env variable

4 participants