使用 dmesg 来查看一些硬件或驱动程序的信息或问题。

求教elasticsearch拼音,容错,模糊搜索的问题

Elasticsearch | 作者 yani | 发布于2016年01月12日 | 阅读数:11399

es配置里用了combo插件,合并ik+pinyin分词器,但是搜索效果不太准确,当我搜索关键词"国邦"时,它会先匹配"郭邦耀",然后才是*国邦*文档,求大神指点
配置文件:
index:
analysis:
analyzer:
ik_max_word:
type: ik
use_smart: false
ik_smart:
type: ik
use_smart: true
pinyin:
type: custom
tokenizer: standard
filter:
- standard
- pinyin_filter
- lowercase
combo:
type: combo
sub_analyzers:
- ik
- pinyin
filter:
pinyin_filter :
type : pinyin
first_letter : none
padding_char : ' '

这里是mapping设置:
curl -XPOST http://localhost:9200/website/blog/_mapping -d'
{
"blog": {
"properties": {
"name": {
"type": "string",
"store": "yes",
"analyzer": "combo",
"searchAnalyzer": "combo"
},
"description": {
"type": "string",
"store": "yes",
"analyzer": "combo",
"searchAnalyzer": "combo"
}
}
}
}'
索引导入:
curl -XPOST http://localhost:9200/_bulk -d'
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "浙江国邦药业有限公司"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "郭邦耀"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "绍兴国企邦联有限公司"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "绍兴县国邦有限公司"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "文字大搜捕"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "不知道能不能搜的到"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "搜索引擎的配置"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "百度搜索的密码"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "ES服务器开发与部署"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "宁波海棠叶子有限公司"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "浙江西湖旅游有限公司"}
{ "index": { "_index": "website", "_type": "blog1"}}
{ "title": "绍兴国家文物博物馆"}

 
已邀请:

medcl - 今晚打老虎。

赞同来自: laoyang360

郭邦和国邦的发音一样,所以他们出现了,但是你需要的是不止是是音同,所以可以再使用一个字段,只是中文分词,你查询的时候,再指定一个这个字段,中文分词的boot权重高于拼音权重,即可。

xiaohu3311

赞同来自:

combo插件ES5好像用不了啊,您的ES使用的哪个版本啊

要回复问题请先登录注册