Problem/Motivation
A misspelling (analyser vs analyzer) in \Drupal\elasticsearch_connector\Event\SynonymsSubscriber::onAlterSettings() means that the querytime_synonyms analyzer doesn't work.
The same misspelling in \Drupal\elasticsearch_connector\SearchAPI\BackendClient::updateSettings() means that analyzers cannot be assigned to fields properly.
Proposed resolution
Change $settings['analysis']['analyser']['querytime_synonyms'] to $settings['analysis']['analyzer']['querytime_synonyms'] in \Drupal\elasticsearch_connector\Event\SynonymsSubscriber::onAlterSettings(). - note this was fixed in #3575982: Elasticsearch property misspelled in SynonymsSubscriber::onAlterSettings.
Change $field_definition['analyser'] to $field_definition['analyzer'] and $field_definition['analyser_settings'] to $field_definition['analyzer_settings'] in \Drupal\elasticsearch_connector\SearchAPI\BackendClient::updateSettings().
Remaining tasks
Add a merge request for 8.0.xx - merge request !175 added by @batkor in #3Add a merge request for 9.0.x- merge request !193 added by @mparker17 in #5Add regression tests- done by @mparker17 by #5Community review- skipped by @mparker17 in #7Maintainer review- done by @mparker17 in #4Commit to 9.0.x- merged by @mparker17 in #8Commit to 8.0.x- merged by @mparker17 in #10Release 9.0.x- released in 9.0.0-alpha3 by @mparker17Release 8.0.x- released in 8.0.0-alpha7 by @mparker17
User interface changes
None.
Introduced terminology
None.
API changes
Only API additions.
Data model changes
None.
Release notes snippet
Fixed a misspelling in SynonymsSubscriber and BackendClient which prevented custom analyzers from being defined and associated with fields.
Original report by @batkor
Analyzer "querytime_synonyms" not working of the typo error.
Issue fork elasticsearch_connector-3570041
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
batkorSee doc. https://www.elastic.co/docs/manage-data/data-store/text-analysis/create-...
Comment #4
mparker17@batkor, thank you for your contribution, and I apologize for the time it has taken me to review this issue!
I can accept most of the changes to
SynonymsSubscriber,SynonymsSubscriberTest,BackendClient, andBackendClientFactory; and you uncovered a part of the module that has been untested until now! So I've written tests (and an example implementation), and I would be happy to credit you on this issue! But, respectfully, some of the changes in your merge request change the class names, namespace, and machine name of the plugin, which will break other sites using this part of the module (my client's site included).This particular misspelling (Analyser) comes from #3271337: Add native support for n-gram and edge n-gram in the Search API OpenSearch module. As a bit of background, when I was brought on as a maintainer of Elasticsearch Connector, the other maintainers wanted the code in this module to echo search_api_opensearch as much as possible for two reasons: first, it would make it easier for site builders to switch between Elasticsearch and OpenSearch with minimal code changes; and second, it would ease the maintenance burden on maintainers in both projects when code can be easily shared between them.
Comment #7
mparker17Filled in the issue summary as documentation for future users. I will merge to 9.0.x first; then I will merge to 8.0.x.
Comment #9
mparker17Merged to 9.0.x; will merge to 8.0.x shortly.
Comment #11
mparker17Merged to 8.0.x. I will update this issue when I have released these changes.
Comment #13
mparker17The changes in this issue were released in elasticsearch_connector-9.0.0-alpha3, and elasticsearch_connector-8.0.0-alpha7
Comment #14
batkorThanks
Comment #15
mparker17@batkor, thank you again for bringing this to my attention!
I noticed that search_api_opensearch has an upcoming 3.x version with no releases, i.e.: where they can make API-breaking changes, so I've filed #3587756: Deprecate "Analyser" in 2.x, use "Analyzer" in 3.x to fix the issue upstream, and I have asked them to credit you when they accept the changes.
When search_api_opensearch accepts the changes in #3587756, then I intend to incorporate more of your original patch to this issue into elasticsearch_connector.
Given how long elasticsearch_connector has spent in alpha, and given that I'm already writing a backwards-compatibility layer in #3587756, I will probably write a similar backwards-compatibility layer for elasticsearch_connector (even if one isn't conventionally necessary), so that I don't break anyone's site. But, hopefully this misspelling will be gone soon!