Other modules that subscribe to PrepareIndexMappingEvent may want to set the analyzer to something other than 'standard'. For example, the Elasticsearch Connector Autocomplete module creates an 'ngram_analyzer'.

The issue is, using the above module as an example, that the ngram_analyzer analyzer gets overwritten by this module, which breaks the functionality of the autocomplete module.

The long term solution of course would be for the Elasticsearch Connector module to allow setting an explicit analyzer/search_analyzer per field rather than allowing anyone to change them through an event handler. But for now, to allow these modules to play nicely together we should only set the analyzer to standard if it is not already set to something else.

Comments

Patrick Ryan created an issue. See original summary.

Patrick Ryan’s picture

Assigned: Patrick Ryan » Unassigned
Status: Active » Needs review
StatusFileSize
new1.37 KB

Here's a patch that will preserve an existing analyzer if one is already set.

dealancer’s picture

Status: Needs review » Reviewed & tested by the community

This patch works for me, at least it does not break anything. Code looks good too.

dealancer’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.