Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Content Fragment Search using GraphQL

Avatar

Level 2

I have a content Fragment with these fields
Title, Page Title, Canonical URL, Description, tags

I am using AEM AMS 6.5 setup. I need to create a GraphQL query for searching a word, say "Service" in multiple fields
example: serach word might be present in either of above mentioned CF fields.
I heard, there is AMS limitation that we cannot use OR or in statmeents. Where as this is possible in AEMaaCS. Also, I want to search the word in tags. But CF stores tag path. Actual Tag title is present in /content/cq:tags So, using GraphQL query, is it possible to search the word to Tag title?

 

query SearchContent($searchTerm: String!, $limit: Int = 10) {
  myModelName(
    filter: {
      title: {
        _expressions: [
          { _operator: CONTAINS, value: $searchTerm }
        ]
      }
	  OR
	  description: {
        _expressions: [
          { _operator: CONTAINS, value: $searchTerm }
        ]
      }
	  
      _path: {
        _expressions: [
          { _operator: STARTS_WITH, value: "/content/dam/abcd" }
        ]
      }
    }
    limit: $limit
  ) {
    items {
      description
      title
    }
  }
}

 cc @arunpatidar @Shashi_Mulugu  @Raja_Reddy  @Saravanan_Dharmaraj  @SureshDhulipudi 

Thanks in advacne

1 Reply

Avatar

Level 10

hi @MaheshaGu,

GraphQL filters from different fields are effectively ANDed and there is no native cross‑field OR/IN; AEMaaCS adds OR within a single field’s expressions, but not a general OR across multiple fields.

When it comes to GraphQL filters on _tags, these filters utilize tag IDs (namespace/path). Therefore, searching using tag titles (jcr:title) is not supported directly.

If tags are stored on the Content Fragment itself, you can achieve your desired functionality as follows:

query {
	cityList(
	filter: {_tags: {_expressions: [{value: "tourism:city-break", _operator: CONTAINS}]}}
	){
		items {
			name,
			_tags
		}
	}
}

If the tags are part of the Content Fragment Metadata, you can also implement it in this way:

query {
  adventureList {
    items {
            _path,
            _metadata {
                  stringArrayMetadata {
                                 name,
                                 value
                  }
            }
      }
  } 
}