【发布时间】:2015-08-07 15:33:53
【问题描述】:
我有一个具有如下文本索引的集合:
db.mycollection.createIndex({ "$**" : "text"},{ "name" : "AllTextIndex"}))
集合的文档有很多文本数据块。我想排除其中一些,以免得到包含与排除块匹配的文本的结果。
但是,我不想像下面那样定义文本索引中的每个字段,以便排除 NotTextSearchableBlock 块:
db.application.ensureIndex({
"SearchableTextBlock1": "text",
"SearchableTextBlock2": "text",
"SearchableTextBlock3": "text"
})
这是一个文档示例:
{
"_id": "e0832e2d-6fb3-47d8-af79-08628f1f0d84",
"_class": "com.important.enterprise.acme",
"fields": {
"Organization": "testing"
},
"NotTextSearchableBlock": {
"something": {
"SomethingInside": {
"Text":"no matcheable text"
}
}
},
"SearchableTextBlock1": {
"someKey": "someTextCool"
},
"SearchableTextBlock2": {
"_id": null,
"fields": {
"Status": "SomeText"
}
},
"SearchableTextBlock3": {
"SomeSubBlockArray": [
{
"someText": "Pepe"
}
]
}
}
【问题讨论】:
-
这有什么更新吗?
标签: mongodb full-text-indexing nosql