我在学习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 } ] }
如果搜索的时候,直接搜“刘”或者“德”,我理解是不能搜到结果的,因为“刘”和“德”没有在分词结果里,但是实际确搜到了,这块理解不了,求大神解答
官网第一个示例:
刘德华被分词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 } ] }
如果搜索的时候,直接搜“刘”或者“德”,我理解是不能搜到结果的,因为“刘”和“德”没有在分词结果里,但是实际确搜到了,这块理解不了,求大神解答
1 个回复
Charele - Cisco4321
赞同来自: JimmyGao
这就是答案。
你用“留”试下,看看能不能搜到华仔。