SolrJ: is not nesting documents

半世苍凉 提交于 2021-01-07 03:33:27

问题


Here my beans:

public class UnitatDenormalized {

    @Field private String id;
    @Field(value= "autors", child = true) private List<Autor> autors = new ArrayList<Autor>();

}

public class Autor {

    @Field private String id;
    @Field private String name;
}

I'm trying to index nested authors as a nested document inside unitat.

Here my straightforward bean initialization:

UnitatDenormalized denormalized = new UnitatDenormalized();

denormalized.setId("giac_img-111-99-5805-415087");

denormalized.addAutors(new Autor("1", "autor1"));
denormalized.addAutors(new Autor("2", "autor2"));

I'm sending document to solr using:

this.solrClient.addBeans(unitats, 1000);

After that, I'm trying to get all authors from the main unitat, but it's empty (q=id:giac_img-111-99-5805-415087 and fl=*,[child]:

$ curl http://localhost:8983/solr/arxius/select?fl=*%2C%5Bchild%5D&q=id%3Agiac_img-111-99-5805-415087
{
  "responseHeader": {
    "status": 0,
    "QTime": 0,
    "params": {
      "q": "id:giac_img-111-99-5805-415087",
      "fl": "*,[child]"
    }
  },
  "response": {
    "numFound": 1,
    "start": 0,
    "numFoundExact": true,
    "docs": [
      {
        "id": "giac_img-111-99-5805-415087",
        "_version_": 1683608997882495000
      }
    ]
  }
}

The only parent is obtained, without nested authors...

Any ideas?

来源:https://stackoverflow.com/questions/64875133/solrj-is-not-nesting-documents

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!