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!
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
@dgshf98678 Your GraphQL query matches with the sample query given in Adobe examples below. Could you try for _match like the example below?
This query illustrates filtering for any person
of name
“Smith”, returning information from across two nested fragments - company
and employee
.
Sample Query
query {
companyList(filter: {
employees: {
_match: {
name: {
_expressions: [
{
value: "Smith"
}
]
}
}
}
}) {
items {
name
ceo {
name
firstName
}
employees {
name
firstName
}
}
}
}
@dgshf98678 Your GraphQL query matches with the sample query given in Adobe examples below. Could you try for _match like the example below?
This query illustrates filtering for any person
of name
“Smith”, returning information from across two nested fragments - company
and employee
.
Sample Query
query {
companyList(filter: {
employees: {
_match: {
name: {
_expressions: [
{
value: "Smith"
}
]
}
}
}
}) {
items {
name
ceo {
name
firstName
}
employees {
name
firstName
}
}
}
}
Views
Likes
Replies
Views
Likes
Replies