Removing last letter of a word - but only some words?


(Søren Madsen) #1

Hi there, elastic-people :slight_smile:

Im new to Elastic, basically working on already implemented settings, where i try to adapt index-setting to my needs.

Right now im working specific with an elasticsearch-extension from Mirasvit (Elasticsuite Ultimate) for Magento 2 - and here i right now face a problem with my search - specific with the last letter on some of the words in my search.

Here a short brief of what im experiencing at the moment:
URL: mikrolab.phhw-131201.cust.powerhosting.dk

I can find results when searching for:
Pumpeslange
Indsats
Skruelågsgla (When you use autocomplete, you can see there's lots of products showing names with "Skruelågsglas")

But when i add "an ending" (primarily in plural) - the search won't return any products even though productname or one of my searchable attribute definitely has the exact word.
E.g.:
Pumpeslanger ('r' makes it plural)
Indsatse ('e' makes it plural)
Skruelågsglas (Here, its actually just the correct word)

The current index-settings are right now:
'analysis' => [
'analyzer' => [
'custom' => [
'type' => 'custom',
'tokenizer' => 'whitespace',
'filter' => [
'word',
'lowercase',
'local_stemmer', (OBS: Sets danish_analyzer for my danish-storeview)
],
],
],
'filter' => [
'local_stemmer' => [
'type' => 'stemmer',
'language' => $this->config->getStemmer($dimension),
],
'word' => [
'type' => 'word_delimiter',
'generate_word_parts' => false,
'generate_number_parts' => false,
'catenate_words' => false,
'catenate_numbers' => false,
'catenate_all' => false,
'split_on_case_change' => false,
'preserve_original' => true,
'split_on_numerics' => false,
'stem_english_possessive' => false,
],
],
],
],
],

Furthermore, i've set up a an regex-expression for my search to:
Match expression: /[a-z][ -][0-9]/i
Replace expression: /[ -]/

This is to make it possible to find my SKU-numbers with/without use of space - but this doesn't seem to be the issue based on my tests.

Hoping you guys can help me out.

Kindly regards
Søren


(Simon Willnauer) #2

I can see that you have already configured a stemmer which should do what you want. Do you query the correct field an can you maybe run an explain query to show what happens to the query terms


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.