有个人长的像洋葱,走着走着就哭了…….

关于拼音搜索能搜中文的一个问题

Elasticsearch | 作者 JimmyGao | 发布于2022年08月31日 | 阅读数:737

我在学习github上的elasticsearch-analysis-pinyin插件
官网第一个示例:
刘德华被分词pinyin_analyzer分词为如下结果:

{ "tokens" : [ { "token" : "liu", "start_offset" : 0, "end_offset" : 1, "type" : "word", "position" : 0 }, { "token" : "de", "start_offset" : 1, "end_offset" : 2, "type" : "word", "position" : 1 }, { "token" : "hua", "start_offset" : 2, "end_offset" : 3, "type" : "word", "position" : 2 }, { "token" : "刘德华", "start_offset" : 0, "end_offset" : 3, "type" : "word", "position" : 3 }, { "token" : "ldh", "start_offset" : 0, "end_offset" : 3, "type" : "word", "position" : 4 } ] }
 
如果搜索的时候,直接搜“刘”或者“德”,我理解是不能搜到结果的,因为“刘”和“德”没有在分词结果里,但是实际确搜到了,这块理解不了,求大神解答
 
 
已邀请:

Charele - Cisco4321

赞同来自: JimmyGao

"token" : "liu"
这就是答案。
 
你用“留”试下,看看能不能搜到华仔。

要回复问题请先登录注册