Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

QueryBuilder in AEM

Avatar

Level 2

Hi,

I want to search for multiple words like "Activity", "testing" etc..This search need to be done under different content paths like "/content/mysite1", "/content/mysite2","/content/mysite3" etc..

This searchtext can be found on jcr:content or any node under jcr:content of the page.

I have written servlet using QueryBuilder for this and able to write query only for single search word and for single content path. How can I do it for multiple search words and multiple content paths?

 

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@mvelicheti- You should divide your search criteria into multiple groups & apply AND group operation.

For example group1 for the full text property, group 2 for path & assume group 3 for the types. 

 

group.1_group.1_fulltext= Activity

group.1_group.2_fulltext= testing

group.1_group.p.or=true

 

group.2_group.1_path=/content/mysite1

group.2_group.2_path=/content/mysite2

group.2_group.p.or=true

 

You can also add another group 3 for the type to further refine search - 

group.3_group.1_type=cq:Page

group.3_group.2_type=dam:Asset

group.3_group.p.or=true

 

Hope this helps!

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@mvelicheti- You should divide your search criteria into multiple groups & apply AND group operation.

For example group1 for the full text property, group 2 for path & assume group 3 for the types. 

 

group.1_group.1_fulltext= Activity

group.1_group.2_fulltext= testing

group.1_group.p.or=true

 

group.2_group.1_path=/content/mysite1

group.2_group.2_path=/content/mysite2

group.2_group.p.or=true

 

You can also add another group 3 for the type to further refine search - 

group.3_group.1_type=cq:Page

group.3_group.2_type=dam:Asset

group.3_group.p.or=true

 

Hope this helps!

Avatar

Community Advisor

Hello @mvelicheti 

 

The search for multiple text under multiple paths for entire Page / asset seems to be resource-intensive. 

Please try executing the query on a system close to production data via http://localhost:4502/libs/cq/search/content/querydebug.html

 

You might want to fine-tune the indexing to get the desired performance


Aanchal Sikka