问题
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