I work in a company which develops a price comparator with Django (1.11). We have uploaded catalogs from merchants and my job is to find the related category for each products. Then, in our website we have about 22 categories (home, dress, glasses, barbecues, speakers, ...) Each catalog uploaded by a merchant has thousand products with properties such as: - name - description - category - price - ... This category can be each a word or a full category path (i.e: dress > shoes > baby > ...)
My question is: how can I find the best category from submitted informations ? I've tried to use trigram search on title but I have too many errors.
categories_by_title = Category.objects\
.annotate(distance=TrigramDistance('name', product_title))\
.filter(distance__lte=0.9)\
.order_by('distance')
Do you know how can I find the most appropriate category function of submitted products ? There are many price comparator but I do not know how they do. Thanks