solr - Solr 中的嵌套 json 对象
问题描述
我已经尝试过http://yonik.com/solr-nested-objects/中的指南,但是在尝试返回带有父 ID 的子文档时,它对我不起作用。
我正在使用最新版本的 Solr,在我的例子中是 Solr 8.1.0。
使用下面的代码返回 book1 与父母的评论。
q = cat_s: (fantasy OR sci - fi) & fl = id, [child parentFilter = type_s: book]
错误消息如下所示:
{
"responseHeader":{
"status":400,
"QTime":70,
"params":{
"q":"cat_s:(fantasy OR sci-fi)",
"fl":"id,[child parentFilter=type_s:book]",
"_":"1560502563083"
}
},
"error":{
"metadata":[
"error-class",
"org.apache.solr.common.SolrException",
"root-error-class",
"org.apache.solr.common.SolrException"
],
"msg":"Parent filter should not be sent when the schema is nested",
"code":400
}
}
解决方案
为了解决这个问题,我必须通过注释掉该行来编辑 managed-schema.xml --> 像这样