如何创建支持阿拉伯语的 MongoDB 全文索引
How to create MongoDB full text index with Arabic language support
正在尝试在 MongoDB 中启用全文搜索。它使用默认语言英语,但不使用阿拉伯语。
我试过这个:
db.Tracks.ensureIndex({
"Name": "text",
"About": "text"
}, {
"name": "tracks_full_text",
"default_language": "ara",
"language_override": "ara"
});
但这显示如下消息
{
"ok" : 0,
"errmsg" : "default_language is not valid",
"code" : 67,
"codeName" : "CannotCreateIndex"
}
根据 MongoDB 目前不支持阿拉伯语。可在此处找到支持的语言列表` https://docs.mongodb.com/manual/reference/text-search-languages/
您仍然可以使用 $regex
运算符代替 (https://docs.mongodb.com/manual/reference/operator/query/regex/) 但它比 $text
索引慢。
P.S 我目前正在为亚美尼亚语创建搜索功能。可能会使用弹性搜索集成。
正在尝试在 MongoDB 中启用全文搜索。它使用默认语言英语,但不使用阿拉伯语。
我试过这个:
db.Tracks.ensureIndex({
"Name": "text",
"About": "text"
}, {
"name": "tracks_full_text",
"default_language": "ara",
"language_override": "ara"
});
但这显示如下消息
{
"ok" : 0,
"errmsg" : "default_language is not valid",
"code" : 67,
"codeName" : "CannotCreateIndex"
}
根据 MongoDB 目前不支持阿拉伯语。可在此处找到支持的语言列表` https://docs.mongodb.com/manual/reference/text-search-languages/
您仍然可以使用 $regex
运算符代替 (https://docs.mongodb.com/manual/reference/operator/query/regex/) 但它比 $text
索引慢。
P.S 我目前正在为亚美尼亚语创建搜索功能。可能会使用弹性搜索集成。