左边是输入,右边索引后的terms,我希望所每一组的term都是position都是0,1,2,这样短语搜索就可以使用任何一种组合,例如postion1的可选有[liu,l],position2:[de,d],position3:[hua,h]
* 刘德华,liudehua=>[liu, de, hua]
* ldh =>[l,d,h]
* 刘德h=>[liu,de,h]
* l德华=>[l,de,hua]
* liudh['liu','d','h']
左边是输入,右边索引后的terms,我希望所每一组的term都是position都是0,1,2,这样短语搜索就可以使用任何一种组合,例如postion1的可选有[liu,l],position2:[de,d],position3:[hua,h]
* 刘德华,liudehua=>[liu, de, hua]
* ldh =>[l,d,h]
* 刘德h=>[liu,de,h]
* l德华=>[l,de,hua]
* liudh['liu','d','h']
同时,我希望索引的结果如下:
{
"tokens": [
{
"token": "l",
"start_offset": 0,
"end_offset": 1,
"type": "word",
"position": 0
},
{
"token": "d",
"start_offset": 1,
"end_offset": 2,
"type": "word",
"position": 1
},
{
"token": "h",
"start_offset": 2,
"end_offset": 3,
"type": "word",
"position": 2
},
{
"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
}
]
}
* 刘德华,liudehua=>[liu, de, hua]
* ldh =>[l,d,h]
* 刘德h=>[liu,de,h]
* l德华=>[l,de,hua]
* liudh['liu','d','h']
左边是输入,右边索引后的terms,我希望所每一组的term都是position都是0,1,2,这样短语搜索就可以使用任何一种组合,例如postion1的可选有[liu,l],position2:[de,d],position3:[hua,h]
* 刘德华,liudehua=>[liu, de, hua]
* ldh =>[l,d,h]
* 刘德h=>[liu,de,h]
* l德华=>[l,de,hua]
* liudh['liu','d','h']
同时,我希望索引的结果如下:
{
"tokens": [
{
"token": "l",
"start_offset": 0,
"end_offset": 1,
"type": "word",
"position": 0
},
{
"token": "d",
"start_offset": 1,
"end_offset": 2,
"type": "word",
"position": 1
},
{
"token": "h",
"start_offset": 2,
"end_offset": 3,
"type": "word",
"position": 2
},
{
"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
}
]
}
4 个回复
medcl - 今晚打老虎。
赞同来自: wmj
帮忙测测。
https://github.com/medcl/elast ... e3378
medcl - 今晚打老虎。
赞同来自: wmj
https://github.com/medcl/elast ... beb42
下载插件; https://github.com/medcl/elast ... 5.3.2
MengPhantom
赞同来自:
wangjueying - Java攻城狮-ES爱好者
赞同来自: