我的 ES 索引中有一些包含表情符号图标的文章。我想搜索包含特定表情符号字符的文章。我使用 compose.io 作为我的 ES 提供程序,通过 ElasticHQ 我可以看到数据中的表情符号 - 它们在 OS X 中呈现为图标,因此我假设 unicode 已正确存储。但是,当我运行此查询时,我没有得到任何结果。如果我运行纯文本搜索,我确实会得到结果。我正在使用 mongoosastic。
Article.search({query_string: {query: "😕"}},
{fields: "title"},
function(err, results) {
if (err) {
console.log("error: " + err);
} else {
console.log("results: " + JSON.stringify(results));
}
});
//results: {"took":6,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
最佳答案
是的,看来ElasticSearch也不能直接启用表情搜索。另外,我尝试使用相应的 unicode 值,但这似乎也不起作用。将原始 unicode 值转换为字符串可能会有所帮助。
关于node.js - Elastic Search中unicode(emoji)字符的字符串查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32911696/