Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

AEM QueryBuilder: How to use contentfragment property?

Avatar

Level 5

I was going through the documentation of predicates supported in querybuilder API: https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/query-builder/quer...

 

Where I see:

spidey1405_0-1663304030891.png

 

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?

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

cf-crx.jpg

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.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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.

cf-crx.jpg

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.

Avatar

Level 7

could you please give me any reference how to put "contentfragment" predicate in java query map.

Is this like map.put("contentfragment","");