Match with dynamic synonyms with Fasttext vectors

In my backend application I want to catch the search keywords of a user and find all synonyms with fasttext before passing it to es. So the idea is as follow:

search terms of user: "couch fabric"

fasttext will return:
couch: lounge, sofa, divan, settee, furniture
fabric: material, textile, weave, stuff, structure

So now I can search with ES:
( couch, lounge, sofa, divan, settee, furniture ) or (fabric, material, textile, weave, stuff, structure)

But the problem I encounter is that I want to give a higher ranking if there are matches for both of the term synonyms and lower ranking for multiple matches on only one term synonym, like this:

"this divan's materials is of top quality"
should have more ranking than
"this divan is a kind of sofa where you can relax"

How can I do this?

PS: I don't want to work with ES synonyms files as this would create large files with a lot of synonyms as I don't know what the user will query beforehand.

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