ELK,萌萌哒

Elasticsearch:如何实现对 emoji 表情符号进行搜索

Elasticsearch | 作者 liuxg | 发布于2021年03月01日 | | 阅读数:1510

Elasticsearch 是一个应用非常广泛的搜索引擎。它可以对文字进行分词,从而实现全文搜索。在实际的使用中,我们会发现有一些文字中包含一些表情符号,比如笑脸,动物等等,那么我们该如何对这些表情符号来进行搜索呢?

🏻 => 🏻, light skin tone, skin tone, type 1–2
🏼 => 🏼, medium-light skin tone, skin tone, type 3
🏽 => 🏽, medium skin tone, skin tone, type 4
🏾 => 🏾, medium-dark skin tone, skin tone, type 5
🏿 => 🏿, dark skin tone, skin tone, type 6
♪ => ♪, eighth, music, note
♭ => ♭, bemolle, flat, music, note
♯ => ♯, dièse, diesis, music, note, sharp
😀 => 😀, face, grin, grinning face
😃 => 😃, face, grinning face with big eyes, mouth, open, smile
😄 => 😄, eye, face, grinning face with smiling eyes, mouth, open, smile
😁 => 😁, beaming face with smiling eyes, eye, face, grin, smile
😆 => 😆, face, grinning squinting face, laugh, mouth, satisfied, smile
😅 => 😅, cold, face, grinning face with sweat, open, smile, sweat
🤣 => 🤣, face, floor, laugh, rofl, rolling, rolling on the floor laughing, rotfl
😂 => 😂, face, face with tears of joy, joy, laugh, tear
🙂 => 🙂, face, slightly smiling face, smile
🙃 => 🙃, face, upside-down
😉 => 😉, face, wink, winking face
 
🐅 => 🐅, tiger
🐆 => 🐆, leopard
🐴 => 🐴, face, horse
🐎 => 🐎, equestrian, horse, racehorse, racing
🦄 => 🦄, face, unicorn
🦓 => 🦓, stripe, zebra
🦌 => 🦌, deer
在上面,我们可以看到各种各样的 emoji 符号。比如我们想搜索 grin,那么它就把含有 😀 emoji 符号的文档也找出来。在今天的文章中,我们来展示如何实现对 emoji 符号的进行搜索。
————————————————
版权声明:本文为CSDN博主「Elastic 中国社区官方博客」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/UbuntuTo ... 61636
 
 

[尊重社区原创,转载请保留或注明出处]
本文地址:http://elasticsearch.cn/article/14252


1 个评论

一个思路参考,表情符号github上面好像有个符号对应编码的工具包,把符号对应的编码加入词典中,然后同义词词典里面同时把表情符号对应的英文单词做对应处理,使得写入可以分出来,自然而然就可以查了。

要回复文章请先登录注册