我正在尝试使用mongo-connector将MongoDB集合索引到Solr中以寻找我想要实现的搜索功能。如果我在mongo中的集合具有非常嵌套的JSON结构,那么我能够在Solr上对其进行索引吗?如果我们想索引下面显示的json,那么Solr中的模式文件会是什么样的?
"profile": {
"id": "1234"
"lastName": "Smith"
"firstname" : "Daniel"
"emails": {
"work": {
"emailAddress": "abc@gmail.com",
"type": "work",
},
"personal": {
"emailAddress": "nml@gmail.com",
"type": "personal",
}
},
"phones": {
"home": {
"phoneNumber": "212345",
},
"work": {
"phoneNumber": "567899",
},
"cell": {
"phoneNumber": "112456",
}
}
}
答案 0 :(得分:0)
mongo connector automagically flattens documents,因此字段名称为:
"emails.work.emailAddress": "abc@gmail.com"
..等允许您通过动态字段定义匹配名称,您可以give field names with wildcards to match multiple different names到相同的字段定义:
<dynamicField name="emails.*" type="string" indexed="true" stored="true"/>
..会将以emails.
开头的每个字段名称索引为字符串字段(仅允许完全匹配)。