Nested Content Fragments with GraphQl
Hello together!
Our setup is that we have Content Fragments from Model A that have a content reference to one Content Fragment of Model B. We want to create a GraphQl Query that returns a list of all Content Fragments from Model A that references a Content Fragment from Model B by specific path. Using SQL this works perfectly as we can just query after the jcr property in which the reference is saved as a string. In GraphQl the refernced field is already resolved as Content Fragment Model, which means it searches for all Content Fragments of Model A and only filters afterwards. As we have a lot of data the query always runs into a timeout. Is there any way I can achieve for the Graphql query to see the reference field as the raw type and not be resolved?
Here my Query:
query listOfModelsByFragmentPath($damPath: ID, $fragmentPath: ID) {
modelAList(
limit: 14
offset: 0
filter: {
_path: {_expressions: [{value: $damPath, _operator: STARTS_WITH}]},
modelBfragment: {_path: {_expressions: [{value: $fragmentPath, _operator: EQUALS}]}}}
) {
items {
url
tags
_path
headline
}
}
}
This is the same SQL Query I would like to achieve:
SELECT main.* FROM [dam:Asset] AS main WHERE ISDESCENDANTNODE(main, 'damPath') AND main.[jcr:content/contentFragment] = true AND main.[jcr:content/data/cq:model] = 'modelA' AND ((ISDESCENDANTNODE(main, 'damPath')) AND (([jcr:primaryType] IS NOT NULL))) AND [jcr:content/data/master/modelBfragment] = 'fragmentPath' OPTION (INDEX TAG[fragments], LIMIT 14)
Any help or guidance is much appreciated!
Thank you!