QueryBuilder in AEM | Community
Skip to main content
Level 2
May 29, 2023
Solved

QueryBuilder in AEM

  • May 29, 2023
  • 2 replies
  • 844 views

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!

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 Rohan_Garg

@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!

2 replies

Rohan_Garg
Community Advisor
Rohan_GargCommunity AdvisorAccepted solution
Community Advisor
May 29, 2023

@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!

aanchal-sikka
Community Advisor
Community Advisor
May 29, 2023

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