How to increase relevance of compound words when using dictionary_decompounder filter


(Psilos) #1

Hi guys,

I have an index with a bunch of products. Among them there are "...smart watch phone..." and "smartphone" products. I used a dictionary_decompounder filter so that even when I search for "smart phone", products with "smartphone" will come up.

However still the products with "...smart watch phone..." description appear first in the list. What i need is to get first the products with "...smartphone..." description.

Is there a way to configure the decompounded words so that they have the highest relevance?

Thank you


(Doug Turnbull) #2

The problem with decompounding, is it places all the tokens in the same position smartphone smart and phone seem to represent identical concepts.

Synonyms, on the other hand, can break apart smartphone into smart with phone, treating them as adjacent position. For example, try the following filter instead of decompounding

"synonym" : {
       "type" : "synonym",
       "synonyms" : [
             "smartphone => smart phone"
       ],
       "preserve_original" : true
}

This lets you then add a phrase query boost like

{
   "query": {
       "bool": {
           "should": [
             {"match_phrase": {
                "text": "smart phone"}},
            {"match": {
                "text": "smart phone"}}
            ]
       }
    }
}

to get closer to your expected behavior


(Psilos) #3

Thnx a lot.

Indeed I now get better results!!


(system) #4