Hello!
We are struggling with a GraphQL query on our AEMaaCS publish instance.
For showing certain news on our Android and iOS mobile apps, we'd like to query a list of article content fragments...
Current state:
Our current query:
query {
articleList(
# does not work
# sort: "articleDate DESC",
filter: {
_path: {
_expressions: [
{
# Path e.g. /content/dam/gpa/articles
value: "/content/dam/oegb/articles"
_operator: STARTS_WITH
}]
},
articleDate: {
_expressions: [
{
# Datetime of last time queried by client
value: "2023-02-15T00:00:00.000Z"
_operator: AFTER
}]
},
# does not work
# _tags: {_expressions: [{value: "meinbrapp", _operator: CONTAINS}]}
}) {
items {
_path
topic
title
subtitle
articleDate
previewText {
html
}
mainText {
html
}
_metadata {
stringArrayMetadata {
name,
value
}
}
},
_references {
... on PageRef {
_publishUrl
}
}
}
}
Any hint is appreciated.
Thank you!
Solved! Go to Solution.
Views
Replies
Total Likes
@martinkastler , you dont need array to check for single value. I test from my local a similar query and this works:
query mySearch($pageSize: Int, $startIndex: Int, $input: String) {
releaseNotesMasterList(
filter: {
input: {_expressions: {_operator: EQUALS, value: $input}},
_path: {_expressions: {_operator: STARTS_WITH, value: "/content/dam/content-fragments/demo"}},
_tags:{_expressions:{_operator:CONTAINS, value:"test1"}}
}
limit: $pageSize
offset: $startIndex
sort: "releaseDate DESC"
) {
items {
_path
}
}
}
When I comment _tags, query returned 2 frags and with _tags filter returned only 1.
So in your case can you try
# _tags: {_expressions: [{value: "meinbrapp", _operator: CONTAINS}]}
to
# _tags: {_expressions: {value: "meinbrapp", _operator: CONTAINS}}
and see if it helps? But honestly with squarebrackets also worked for me.
1 more consideration, tag references work ONLY with cq:tags. When you goto Tagging and check references from the tag, your CF must show up under References like this
Tag references will NOT work for custom tag properties.
Last consideration, incase you are trying against custom properties, I ran into weird issue and adding `_ignoreCase: true` solved for me. I documented here. https://medium.com/@bsaravanaprakash/how-to-filter-properties-with-custom-namespaces-in-aem-graphql-...
Hope this helps.
@AsifChowdhury @Shiv_Prakash_Patel @nitesh_kumar @Rohit_Utreja
Can you please dedicate some time to review this AEM question and offer your expert insights? Additionally, if you could provide the author with some guidance or direction to tackle the problem, it would be most appreciated.
Views
Replies
Total Likes
@martinkastler , you dont need array to check for single value. I test from my local a similar query and this works:
query mySearch($pageSize: Int, $startIndex: Int, $input: String) {
releaseNotesMasterList(
filter: {
input: {_expressions: {_operator: EQUALS, value: $input}},
_path: {_expressions: {_operator: STARTS_WITH, value: "/content/dam/content-fragments/demo"}},
_tags:{_expressions:{_operator:CONTAINS, value:"test1"}}
}
limit: $pageSize
offset: $startIndex
sort: "releaseDate DESC"
) {
items {
_path
}
}
}
When I comment _tags, query returned 2 frags and with _tags filter returned only 1.
So in your case can you try
# _tags: {_expressions: [{value: "meinbrapp", _operator: CONTAINS}]}
to
# _tags: {_expressions: {value: "meinbrapp", _operator: CONTAINS}}
and see if it helps? But honestly with squarebrackets also worked for me.
1 more consideration, tag references work ONLY with cq:tags. When you goto Tagging and check references from the tag, your CF must show up under References like this
Tag references will NOT work for custom tag properties.
Last consideration, incase you are trying against custom properties, I ran into weird issue and adding `_ignoreCase: true` solved for me. I documented here. https://medium.com/@bsaravanaprakash/how-to-filter-properties-with-custom-namespaces-in-aem-graphql-...
Hope this helps.
Views
Likes
Replies