solr - solr 8 嵌套文档/如何使用 Child Doc Transfomer
问题描述
从文档草稿中我可以看到 SOLR 8 对嵌套文档进行了一些改进
我已经按照该指南进行了尝试并尝试了这个:创建核心
➜ ./bin/solr create -c test
发布一个嵌套的 json
➜ ./bin/post -c test nested.json
查询所有文档
➜ curl "localhost:8983/solr/test/select?q=*:*"
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"*:*"}},
"response":{"numFound":2,"start":0,"docs":[
{
"ID":[1],
"title":["Cooking Recommendations"],
"tags":["cooking",
"meetup"],
"posts.ID":[2,
5],
"posts.title":["Cookies",
"Cakes"],
"posts.comments.ID":[3,
4],
"posts.comments.content":["Lovely recipe",
"A-"],
"id":"2bbde94d-3058-49d2-a53b-74dbc2d417e0",
"_version_":1633529758781276160},
{
"ID":[6],
"title":["For Hire"],
"tags":["professional",
"jobs"],
"posts.ID":[7,
10],
"posts.title":["Search Engineer",
"Low level Engineer"],
"posts.comments.ID":[8,
9],
"posts.comments.content":["I am interested",
"How large is the team?"],
"id":"8276a056-d731-4707-81ec-bbc3624e7763",
"_version_":1633529758785470464}]
}}
➜ curl "http://localhost:8983/solr/test/select?fl=ID,[child childFilter=/comments/content:recipe]&q=ID:1"
{
"responseHeader":{
"status":400,
"QTime":1,
"params":{
"q":"ID:1",
"fl":"ID,[child childFilter=/comments/content:recipe]"}},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"],
"msg":"undefined field content",
"code":400}}
我在这里缺少什么?我是否需要启用更多功能才能使用此查询q=ID:1, fl=ID,[child childFilter=/comments/content:recipe]
?
更多:在该文档中,查询响应是一个带有子元素的 json 文档,相反,如果我进行简单查询,我仍然有一个扁平化文档
curl http://localhost:8983/solr/test/get?id=2bbde94d-3058-49d2-a53b-74dbc2d417e0
{
"doc":
{
"ID":[1],
"title":["Cooking Recommendations"],
"tags":["cooking",
"meetup"],
"posts.ID":[2,
5],
"posts.title":["Cookies",
"Cakes"],
"posts.comments.ID":[3,
4],
"posts.comments.content":["Lovely recipe",
"A-"],
"id":"2bbde94d-3058-49d2-a53b-74dbc2d417e0",
"_version_":1633529758781276160}}
解决方案
推荐阅读
- python - Python 3 如何访问套接字客户端地址?
- php - 文件上传时通知用户
- android - Android Room 数据库 ViewModel 不反映同步插入的数据
- python - Django:向管理通用视图添加简单按钮
- javascript - 如何在 jquery 中动态获取 UL 和 LI 值
- json - JSONDecodeError:期望值第 1 行第 1 列(字符 0)
- xpath - 使用机器人框架查找具有“选定”属性的选项标签
- python - 将 matplotlib 饼图标签旋转 90 度
- dpdk - Mellanox ConnectX-3 不支持 DPDK 数据包分段?
- permutation - 通过汉明权重枚举整数,模位移