身安不如心安,屋宽不如心宽 。

能否手工修改字段的分词结果呢

Elasticsearch | 作者 zhugw | 发布于2019年11月26日 | 阅读数:1644

使用的是ik_smart分词器 将企业名称:上海绿谷制药有限公司 拆分成了 上 海绿 谷 制药 导致输入绿谷制药 该公司没有排在前面 
 
有没有办法可以直接修改该企业的分词结果呢? 修改为 上海 绿 谷 制药 呢
 
curl -XGET "http://localhost:9201/company/ ... retty -H 'Content-Type: application/json' -d'
{
"fields": ["name"],
"offsets": true,
"payloads": true,
"positions": true,
"term_statistics": true,
"field_statistics": true
}'

{
"_index": "company",
"_type": "_doc",
"_id": "2",
"_version": 270,
"found": true,
"took": 91,
"term_vectors": {
"name": {
...
"terms": {
"上": {
"doc_freq": 640854,
"ttf": 642463,
"term_freq": 1,
"tokens": [{
"position": 0,
"start_offset": 0,
"end_offset": 1
}]
},
"制药": {
"doc_freq": 14037,
"ttf": 14063,
"term_freq": 1,
"tokens": [{
"position": 3,
"start_offset": 4,
"end_offset": 6
}]
},
"海绿": {
"doc_freq": 9638,
"ttf": 9638,
"term_freq": 1,
"tokens": [{
"position": 1,
"start_offset": 1,
"end_offset": 3
}]
},
"谷": {
"doc_freq": 170271,
"ttf": 171308,
"term_freq": 1,
"tokens": [{
"position": 2,
"start_offset": 3,
"end_offset": 4
}]
}
}
}
}
}

 
 
已邀请:

core_wzw - 某AILab搜索技术负责人

赞同来自: bwCoder

把上海、绿谷、制药放到ik默认词典里就行

micmouse521

赞同来自:

可以自定义分词器的,装个ik分词插件试试

要回复问题请先登录注册