ElasticPress icon indicating copy to clipboard operation
ElasticPress copied to clipboard

Create `default_search` analyzer while setting up synonyms

Open felipeelia opened this issue 3 years ago • 0 comments

Is your enhancement related to a problem? Please describe.

Currently, ElasticPress has only a default analyzer used on both index and search time. That is usually not a problem but when we add the Synonym's token filter here we end up having word_delimiter_graph and synonym_graph being applied at the same time.

As that is not fully supported, we eventually get a [illegal_argument_exception] startOffset must be non-negative, and endOffset must be >= startOffset, and offsets must not go backwards startOffset=??,endOffset=??,lastStartOffset=?? for field '??' error like seen in #2838.

Describe the solution you'd like

As we don't index everything after saving synonyms, we could apply the synonym_graph only during search time. Having word_delimiter_graph applied only during index time should not be a problem as well.

To have that happen, we need to create a default_search analyzer during the synonyms setup instead of simply adding synonym_graph to the default one.

felipeelia avatar Jun 30 '22 20:06 felipeelia