Does AEM Query builder API allow searching the Content Fragment Core component's content included within a Page?

nagarjunav

23-09-2019

Hi All,

Please advise if AEM Query builder API supports searching of Content Fragment's (Adobe's Core component) content included within a Page.

I have added a Content Fragment core component on an empty content page (newly created) and authored all the required values for the component including fragmentPath. The component renders as expected and displays the Content Fragment data. However, when I tried searching for the data within content fragment using the following sample queries through Query Builder Debugger, it did not return any results. I am not sure if any new predicates are needed to enable the search functionality for content fragments.

Query Builder query 1:

type=cq:Page

path=<search path>(e.g., /content/we-retail/us/en)

fulltext=<searchterm> (e.g., winter)

Query Builder query 2:

type=cq:Page

path=<search path>(e.g., /content/we-retail/us/en)

fulltext=<searchterm> (e.g., winter)

contentfragment

AEM Version: 6.3.3.0

AEM Core Components Version: 2.5.0

Any advise or guidance would be greatly appreciated. Thank you in advance.

kautuk sahni  smacdonald2008

Replies

Highlighted
Highlighted

nagarjunav

24-09-2019

I don't see the "Attach" option to upload the package even in the advanced editor. Is there any other option to share the package?

Screen Shot 2019-09-24 at 3.09.56 PM.png

Highlighted

berliant

Employee

24-09-2019

Assuming that we have a custom index that supports CF model's property, we need a union query similar to:

path=/content

1_group.1_type=nt:unstructured

1_group.1_property=name

1_group.1_property.value=Jason Chester

group.p.and

group.2_type= cq:Page

group.2_fulltext=contentfragment

Unfortunately, here it reaches a limitation of AEM 6.3 oak engine for union queries support.

If a search of CF with Multiple Elements is a firm business requirement, you can explicitly add all required element:

1837206_pastedImage_7.png

with that configuration you can use the query, that I suggested earlier:

path=/content/we-retail/us

type= cq:Page

group.p.and

group.1_fulltext=winter

group.2_fulltext=contentfragment

Highlighted

nagarjunav

25-09-2019

berliant Thank you!

I tried adding all the required elements within CF as recommended. But it did not resolve the search issue even with the custom index.

Screen Shot 2019-09-25 at 11.14.07 AM.png

The business requirement is to implement search capability for multiple elements of structured content fragments included on a page. We are trying to replace existing components with core content fragment components to enable content reuse across different projects/channels. But after implementing the change in a test environment, the search does not seem to work and no longer returning appropriate search results as the CF data is not available on the page.

The search does not seem to work with the Core Content Fragment component as it does not automatically add the "text" property containing selected Structured Content Fragment elements data to the component node unlike the OOB Content Fragment Component which adds the "text" property. Search works appropriately with the OOB Content Fragment Component as the CF data is available within Page structure under respective component.

Find below the "Core Content Fragment Component" node data for a test page without the "text" property.

Screen Shot 2019-09-25 at 10.59.17 AM.png

Find below the "OOB Content Fragment Component" node data containing "text" property for the same test page.

Screen Shot 2019-09-25 at 10.59.52 AM.png

Could you please let me know how the automatic addition of "text" property works for OOB component and if the same capability may be activated for the Core component to enable search functionality.

Highlighted

berliant

Employee

25-09-2019

I used your package for the test.

1. I modified the Test Page by editing the CF component. My changes implied adding two components:

1837418_pastedImage_1.png

2. It means that now the node structure includes two additional properties: elementNames and text:

1837419_pastedImage_2.png

3. Now we can use full-text search capabilities and jcr:contains function:

path=/content/we-retail/us

type= cq:Page

group.p.and

group.1_fulltext=Jason

group.2_fulltext=contentfragment

1837420_pastedImage_8.png

Note, that the query is using oak:index/cqPageLucene

For a full-text search, you don't need to edit indexes.

Make sure, that you have the same configuration and the query execution plan is also similar to what I see on my test machine. If this is not a case, it might be some bigger issue related to an oak/indexing on your AEM.

At that point, I suggest opening a support case and have a screen session with a support engineer.