Hello,
I would like to request data via GraphQL query based on a Tag multifield like this:
The parameters to return this data should be for example:
I tried this query:
query ($adventureTags: [String]) {
adventureList(
filter: {
adventureTags: {_logOp: OR, _expressions: [{values: $adventureTags, _operator: EQUALS}]}
}) {
items {
_path
adventureTags
}
}
}
It's only returning data if I add all parameters like this
but does not return anything for this
Additionally I've tried to request the data with the persisted queries and the default cloud sdk dispatcher config like this:
But that does not return any data.
And if I run the query on author it works:
It seems almost like this use case is not supported and I could not find any info about this in the Adobe docs. Can somebody help me here or has done something similar?
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @12nalk123
I have tested out the same from my end, the reason why the first query is working and not the second one is it compares the full jcr property in the graphQL query and retrieve the result (below screenshot). It is expecting the same authored query params to be passed for the query to execute
For dispatcher URL, did you check if there's any error in the network console for any 404 issue ?
For reference :
Hope this helps
Hi @PRATHYUSHA_VP ,
thank you very much for helping. Regarding
@PRATHYUSHA_VP wrote:I have tested out the same from my end, the reason why the first query is working and not the second one is it compares the full jcr property in the graphQL query and retrieve the result (below screenshot). It is expecting the same authored query params to be passed for the query to execute
If I understand you correctly, this means that the
_logOp: OR
is not possible with tags/values inside an array?
------
For dispatcher URL, did you check if there's any error in the network console for any 404 issue ?
The issue is no 404 error but an empty result list:
{
"data": {
"adventureList": {
"items": [
]
}
}
}
AND I just noticed I had a wrong query string for the publisher URL. That means it's no publish/dispatcher problem but a general persisted query problem.
I use this parameter string
After encoding it looks like this
And if I use this on author/publisher/dispatcher an empty result is returned.
For example author:
And in the GraphiQL UI there is a result returned (see image attached).
Views
Replies
Total Likes
Hi @12nalk123
As @sarav_prakash mentioned, in order to fetch data which are tagged under single tag use CONTAINS in query, it should be something like below -
query {
adventureList(
filter: {
adventureTags: {_logOp: OR, _expressions: [{value: "wknd-shared:activity/cycling", _operator: CONTAINS}]}
}) {
items {
_path
adventureTags
}
}
}
If you want to fetch data which are tagged using multiple tags, follow as below :
Also, regarding 404 issue , can you please check if content fragments are published and content is reflected
Hope this helps
Views
Replies
Total Likes
Hi @12nalk123 , here is the example query you are looking for
In your above query you are doing `_operator:EQUALS`. This will return result only if ALL values exactly match as you explain. Instead you must change to `_operator:CONTAINS`
So I wrote a query as
query mywelcome {
myContentList(
filter: {_tags: {_expressions: [{value: "properties:orientation/portrait", _operator: CONTAINS}]}}
) {
items {
_tags
_path
}
}
}
This returns all fragments tagged with portrait. Plus fragment with other tags are also returned.
So your query should be changed as
query ($adventureTags: [String]) {
adventureList(
filter: {
adventureTags: {_logOp: OR, _expressions: [{values: $adventureTags, _operator: CONTAINS}]}
}) {
items {
_path
adventureTags
}
}
}
Views
Replies
Total Likes