我想在solr中索引和搜索嵌套的json.这是我的json代码
{
"id": "44444",
"headline": "testing US",
"generaltags": [
{
"type": "person",
"name": "Jayalalitha",
"relevance": "0.334",
"count": 1
},
{
"type": "person",
"name": "Kumar",
"relevance": "0.234",
"count": 1
}
],
"socialtags": {
"type": "SocialTag",
"name": "US",
"importance": 2
},
"topic": {
"type": "Topic",
"name": "US",
"score": "0.936"
}
}Run Code Online (Sandbox Code Playgroud)
当我尝试索引时,我收到错误"解析JSON字段值时出错.意外的OBJECT_START"
当我们尝试使用多值字段和索引时,我们无法使用多值字段进行搜索?它回归的"未定义场"
如果我需要在schema.xml文件中进行任何更改,请提供建议吗?
您正在文档中嵌套子文档.您需要在JSON中使用适当的嵌套子文档语法:
[
{
"id": "1",
"title": "Solr adds block join support",
"content_type": "parentDocument",
"_childDocuments_": [
{
"id": "2",
"comments": "SolrCloud supports it too!"
}
]
},
{
"id": "3",
"title": "Lucene and Solr 4.5 is out",
"content_type": "parentDocument",
"_childDocuments_": [
{
"id": "4",
"comments": "Lots of new features"
}
]
}
]
Run Code Online (Sandbox Code Playgroud)
看看这篇介绍JSON子文档和块连接的文章.
| 归档时间: |
|
| 查看次数: |
4600 次 |
| 最近记录: |