使用wordnet的Elasticsearch同义词搜索不起作用 [英] Elasticsearch Synonym search using wordnet not working

查看:85
本文介绍了使用wordnet的Elasticsearch同义词搜索不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调试我的同义词搜索.似乎当我使用Weetet格式并使用wn_s.pl文件时,它不起作用,但是当我使用自定义synonym.txt文件时,它起作用了.请让我知道我做错了.请找到下面的索引:

I tried to debug my synonym search .it seems like when i use wornet format and use the wn_s.pl file it doesn't work, but when i use a custom synonym.txt file then it works.Please let me know where i am doing wrong.please find my below index:

{
    "settings": {
        "index": {
            "analysis": {
                "filter": {
                    "synonym": {
                        "type": "synonym",
                        "format": "wordnet",
                        "synonyms_path": "analysis/wn_s.pl"
                    }

                },
                "analyzer": {
                    "synonym": {
                        "tokenizer": "standard",
                        "filter": ["lowercase",
                            "synonym"
                        ]
                    }

                },
                "mappings": {
                    "properties": {
                        "firebaseId": {
                            "type": "text"
                        },
                        "name": {
                            "fielddata": true,
                            "type": "text",
                            "analyzer": "standard"
                        },
                        "name_auto": {
                            "type": "text"
                        },

                        "category_name": {
                            "type": "text",
                            "analyzer": "synonym"

                        },
                        "sku": {
                            "type": "text"
                        },
                        "price": {
                            "type": "text"
                        },
                        "magento_id": {
                            "type": "text"
                        },
                        "seller_id": {
                            "type": "text"
                        },
                        "square_item_id": {
                            "type": "text"
                        },
                        "square_variation_id": {
                            "type": "text"
                        },
                        "typeId": {
                            "type": "text"
                        }
                    }
                }
            }
        }
    }
}

我正在尝试对category_name进行同义词搜索,我有诸如鞋子和衣服之类的物品.当我搜索靴子,人字拖鞋或拖鞋时,什么都没有.

I am trying to do synonym search on category_name ,i have items like shoes and dress etc .when i search for boots,flipflop or slipper nothing comes.

这是我的查询搜索:

{
    "query": {
        "match": {
            "category_name": "flipflop"
        }
    }
}

推荐答案

您的wordnet同义词格式不正确.请在此处看看为了快速实施,请查看 synonyms.json

Your wordnet synonym format is not correct. Please have a look here For a fast implementation please look at the synonyms.json

这篇关于使用wordnet的Elasticsearch同义词搜索不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆