在mongodb的俄文全文搜索

qik*_*qik 4 full-text-search mongodb

我正在尝试在mongodb中使用全文搜索:

> db.collection.insert({"text" : "?????? ?????? ??????"})
> db.collection.insert({"text" : "?????? ?????? ??????"})
> db.collection.insert({"text" : "?????? ?????? ??????"})
> db.collection.ensureIndex({"text" : "text"}, {"default_language" : "russian"})
Run Code Online (Sandbox Code Playgroud)

句子只在字母案件中有所不同.

> db.collection.runCommand("text" , {search : "??????"})
{
        "queryDebugString" : "????||||||",
        "language" : "russian",
        "results" : [
                {
                        "score" : 0.6666666666666666,
                        "obj" : {
                                "_id" : ObjectId("516acfe2dbfd90a837e09131"),
                                "text" : "?????? ?????? ??????"
                        }
                },
                {
                        "score" : 0.6666666666666666,
                        "obj" : {
                                "_id" : ObjectId("516acfe8dbfd90a837e09132"),
                                "text" : "?????? ?????? ??????"
                        }
                }
        ],
        "stats" : {
                "nscanned" : 2,
                "nscannedObjects" : 0,
                "n" : 2,
                "nfound" : 2,
                "timeMicros" : 86
        },
        "ok" : 1
}
Run Code Online (Sandbox Code Playgroud)

结果只包含两个条目,但应该是三个.在英语中一切都很好.

J R*_*ssi 5

这是MongoDB 2.4中存在的文本搜索的已知限制.出于文本搜索的目的,MongoDB将每个字符"ABCDEFGHIJKLMNOPQRSTUVWXYZ"(POSIX语言环境中设置的"大写")与其小写等效字符相同,但它会将其他UTF-8代码点视为唯一.

UTF-8的完整案例折叠支持将在未来发布; 请参阅JIRA中的相关票证,网址https://jira.mongodb.org/browse/SERVER-8423.