从文档草案中我可以看到SOLR 8在nested documents上有一些改进
我已经按照该指南进行了尝试: 创建核心
➜ ./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]
吗?
更多:在该文档中,查询响应是一个带有child的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}}