mongodb中的复杂文本索引

时间:2016-02-10 11:44:50

标签: mongodb mongodb-query mongodb-.net-driver

我的文件中有这样的属性

"Resources" : {
    "Data" : [ 
        [ 
            "ru.Title", 
            "Привет, Мир"
        ], 
        [ 
            "ru.ManualExcerpt", 
            null
        ], 
        [ 
            "ru.AutoExcerpt", 
            "Привет, Мир "
        ], 
        [ 
            "ru.Body", 
            "<p>Привет, Мир</p>\n"
        ], 
        [ 
            "en.Title", 
            "Hello world"
        ], 
        [ 
            "en.ManualExcerpt", 
            null
        ], 
        [ 
            "en.AutoExcerpt", 
            "Hello world "
        ], 
        [ 
            "en.Body", 
            "<p>Hello world</p>\n"
        ]
    ]
},

我需要为每个项目创建文本索引。我试图做这样的事情

db.document.ensureIndex(
{
    "Resources.Data[0][1]": "text",
    "Resources.Data[1][1]": "text",
    "Resources.Data[2][1]": "text",
    "Resources.Data[3][1]": "text",
    "Resources.Data[4][1]": "text",
    "Resources.Data[5][1]": "text",
    "Resources.Data[6][1]": "text",
    "Resources.Data[7][1]": "text"
},
{ name: "text-index" }

但搜索仍无效。在我的情况下是否可以创建索引?

0 个答案:

没有答案
相关问题