AEM QueryBuilder: How to use contentfragment property? | Community
Skip to main content
Level 4
September 16, 2022
Solved

AEM QueryBuilder: How to use contentfragment property?

  • September 16, 2022
  • 1 reply
  • 1617 views

I was going through the documentation of predicates supported in querybuilder API: https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/query-builder/querybuilder-predicate-reference.html?lang=en#:~:text=or%20%22%20false%22-,contentfragment,-Restricts%20the%20result

 

Where I see:

 

But I am not sure how to use it?

I tried keeping it as is:

```

type=nt:unstructured
path=/content/dam/rallyhealth/ichabod/articles
p.hits=selective
nodename=master
p.properties=author featuredImage

contentfragment

```

 

I also tried:

```

type=nt:unstructured
path=/content/dam/rallyhealth/ichabod/articles
p.hits=selective
nodename=master
p.properties=author featuredImage

contentfragment=article

```

But all of this return no response. Can someone help me understand how can one use it?

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by lukasz-m

Hi @spidey1405,

In general contentFragment predicate checks, if there is a contentFragment property with true value, located under jcr:content node. Base on that contentFragment predicate decides if given resource is recognized as content fragment or not and if it should be included in the results.

How to use it? Here is an example of predicate - it worked correct, and I get CF only as a result.

type=dam:Asset
path=/content/dam
contentfragment

contentFragment predicate does not require any additional value if you want to use it. Using contentFragment keyword in query will be enough. However I believe it will only return proper results if you will use it with dam:Asset type. At least it was working for me with dam:Asset type, which make sens because this will allow to use dedicated index related to dam:Asset type.

1 reply

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
September 16, 2022

Hi @spidey1405,

In general contentFragment predicate checks, if there is a contentFragment property with true value, located under jcr:content node. Base on that contentFragment predicate decides if given resource is recognized as content fragment or not and if it should be included in the results.

How to use it? Here is an example of predicate - it worked correct, and I get CF only as a result.

type=dam:Asset
path=/content/dam
contentfragment

contentFragment predicate does not require any additional value if you want to use it. Using contentFragment keyword in query will be enough. However I believe it will only return proper results if you will use it with dam:Asset type. At least it was working for me with dam:Asset type, which make sens because this will allow to use dedicated index related to dam:Asset type.

Level 4
September 16, 2022

Got it, makes sense. Thanks a lot Lukasz