Can we pass multiple string values for a single filter to fetch the CF response | Adobe Higher Education
Skip to main content
Level 1
March 12, 2026
Question

Can we pass multiple string values for a single filter to fetch the CF response

I have a requirment where we have a listing page with restaurants (cards). There is a filter and when end user select single filter example cuisine=french. im able to fetch the data from graphql query and return the CFs which has a tag called french. Now if end user selects multiple filters like french and italian then i need to show all the CFs which has tags french and italian through graphql.

 

I have tried multiple ways but im getting null values
sample query:
query getDiningList( $langcode: String,$tag1: [String], $tag2:String,$offset: Int,$limit: Int) {
  diningList(
    includeVariations: true
    _locale:$langcode
    offset: $offset
    limit: $limit
       filter:{
        _path:{
        _expressions:[
          {_operator: STARTS_WITH,value:"/content/dam/test/cfm"}
        ]
        },
      cuisineTag:{
         _logOp:OR
        _expressions:[{_operator:CONTAINS , values:$tag1}],
      }
        locationTag:{
           _expressions:[{_operator: CONTAINS, value:$tag2}]
        }
    }
  ){
      items{
                        _path
               __typename
                title
                categoryTag
                cuisineTag
                locationTag
                teaserTitle
                teaserDescription

  }
  }
}
 

Sample endpoint URL: /graphql/execute.json/test/getDiningListing;langcode=en;tag1=french,italian;offset=0;limit=6;

Is this endpoint url correct for sending multiple string values for tag1? 

Provide an approach whether we can fetch the data with a filter having multiple string values or should we try with any alternative approach?

    2 commentaires

    rk_pandian
    Level 4
    March 12, 2026

    Hello ​@Saiteja-09 , I see that the difference here is the value and values keyword.

    • value - can accept one String
    • values - can accept multiple Strings

    In the above code inside cuisineTag block, the first expression has values, but I dont think an array is being sent there.

    If you want to check against multiple Strings, use values followed by [String1,String2] etc. Below is my example to check multiple arguments against one field. I went with tagfield here to stick with your scenario.

    Please note that CONTAINS operator didn’t work with String array. I tried with IN but it seems that we need a service pack (depending on the current AEM version) and another graphql package to make it work. Unfortunately I was not able to test it out today.

    In your case, if you have less filters, then pass them as separate variables and use them for each value.

    For multiple values, pass as an Array from the client side.

    Hope this helps.

    {
    viewModeModelList(filter:
    {
    viewMode: {
    _logOp: OR
    _expressions: [
    {
    value: "properties:orientation/portrait",
    _operator: EQUALS
    }
    {
    value: "properties:orientation/landscape",
    _operator: EQUALS
    }
    # {
    # values: ["properties:orientation/landscape","properties:orientation/portrait"],
    # _operator: IN
    # }
    ]
    }
    }) {
    items {
    viewMode
    }
    }
    }

     

    Regards,

    Ramkumar

    AmitVishwakarma
    Community Advisor
    Community Advisor
    March 13, 2026

    Hi ​@Saiteja-09 

    Yes, you can filter by multiple tag values – your GraphQL is close, the URL variables are wrong.

    1. GraphQL (recommended pattern)

    query getDiningList(
    $langcode: String
    $cuisines: [String] # multi-value variable
    $location: String
    $offset: Int
    $limit: Int
    ) {
    diningList(
    includeVariations: true
    _locale: $langcode
    offset: $offset
    limit: $limit
    filter: {
    _path: {
    _expressions: [{ _operator: STARTS_WITH, value: "/content/dam/test/cfm" }]
    }
    cuisineTag: {
    _logOp: OR
    _expressions: [{ _operator: EQUALS, values: $cuisines }]
    }
    locationTag: {
    _expressions: [{ _operator: CONTAINS, value: $location }]
    }
    }
    ) {
    items { _path title cuisineTag locationTag }
    }
    }

    2. How to pass multiple values

    Your URL:

    ...;tag1=french,italian;...

    is treated as one string, not a list.

    Use either:

    Headless SDK (best):

    runPersistedQuery("test/getDiningListing", {
    langcode: "en",
    cuisines: ["french", "italian"],
    location: "paris",
    offset: 0,
    limit: 6
    });

    Or raw URL with a list literal (then URL‑encode it):

    /graphql/execute.json/test/getDiningListing;cuisines=["french","italian"];langcode=en;offset=0;limit=6

    That will correctly return CFs tagged with french OR italian.

    Amit Vishwakarma - Adobe Commerce Champion 2025 | 16x Adobe certified | 4x Adobe SME