Expand my Community achievements bar.

Multiple Tags as parameters for GraphQL persisted queries

Avatar

Level 2

Hello,

 

I would like to request data via GraphQL query based on a Tag multifield like this:

12nalk123_0-1733998333565.png

The parameters to return this data should be for example:

  • ["wknd-shared:season/summer"]
  • ["wknd-shared:season/summer", "wknd-shared:season/spring"]

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

  • ["wknd-shared:season/summer", "wknd-shared:season/spring"]

but does not return anything for this

  • ["wknd-shared:season/summer"]

Additionally I've tried to request the data with the persisted queries and the default cloud sdk dispatcher config like this:

http://localhost:8080/graphql/execute.json/wknd-shared/adventures-all%3BadventureTags%3D%5B%22wknd-s...

But that does not return any data. 

And if I run the query on author it works:

http://localhost:4502/graphql/execute.json/wknd-shared/articles-all;adventureTags=%3BadventureTags%3... 

 

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

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Level 5

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 

 

PRATHYUSHA_VP_0-1734617831182.png

 

 

For dispatcher URL, did you check if there's any error in the network console for any 404 issue ?

 

For reference :

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-6-5-17-graphql-persist...

 

Hope this helps

 

 

 

 

Avatar

Level 2

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

  • ;adventureTags=["wknd-shared:season/summer", "wknd-shared:season/spring"]

After encoding it looks like this

  • %3BadventureTags%3D%5B%22wknd-shared%3Aseason%2Fsummer%22%2C%20%22wknd-shared%3Aseason%2Fspring%22%5D

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).