I have following parent-child models
parent:
public class DataSet {
@Field
private String id;
@Field
private String type="type_dataset";
@Field
private String name;
@Field
private String dataSourceId;
@Field
private String serviceId;
@Field(child=true)
private List<DataSetColumn> columns;
}
child:
public class DataSetColumn {
@Field
private String id;
@Field
private String name;
@Field
private String type="type_column";
}
I can query for parent documents filtered by fields belonging to the parent as:
http://solrserver:8886/solr/BeanTest10/select?q=*:*&fq=(type:type_dataset)&fl=*,[child
parentFilter=type:type_dataset]&wt=json&indent=true
Now I want to:
How can I achieve this ?
Yes, you could achieve something like this wit the power of BlockJoinParentQueryParser.
Basic syntax is the following - q={!parent which=<allParents>}<someChildren>
In your case it could be transformed to something like - +{!parent which="type:type_dataset"}name:random* +service_id:1
The trick to return child documents will be the same (child doc transformer):
fl=data_id,[child parentFilter=type:type_dataset]
If needed you could limit child fields as well via fl
construction.