Is it possible to query contains some using GQL in AEM?
Example:
title contains: ["Health","doctor","medicine"]
If it contains anyone of them then return true.
One way would be to individually add these elements:
{
_expressions: [
{
_operator:CONTAINS
value:"health"
}
{
_operator:CONTAINS
value:"Health"
}
{
_operator:CONTAINS
value:"healthy"
}
]
However I was interested in knowing a better solution like:
{
_expressions: [
{
_operator:CONTAINS
values: [
"Health",
"health"
]
}
]
}
I get : Cannot compare single value to an array. when I implement the above. I wanted to know the only way possible to query contains_some is by first method?
Solved! Go to Solution.
Views
Replies
Total Likes
@spidey1405
Ideally the example quoted above would not require 3 values to be compared
{
_expressions: [
{
_operator:CONTAINS
_ignoreCase: true
value:"health"
}
]
}
However, if its just a sample content. the method quoted by @SantoshSai could be explored
Hi @spidey1405,
Please check this if it helps: https://stackoverflow.com/questions/37981269/how-to-search-string-values-in-graphql
Regards,
Santosh
@spidey1405
Ideally the example quoted above would not require 3 values to be compared
{
_expressions: [
{
_operator:CONTAINS
_ignoreCase: true
value:"health"
}
]
}
However, if its just a sample content. the method quoted by @SantoshSai could be explored
Views
Likes
Replies
Views
Likes
Replies