Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

AEM Search Component

Avatar

Level 2

For Implementing a Search Component I have used query builder API but it seems like it is causing performance issues as it searches fullsearch under /content . Is there any other way to implement the search component please let me know.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @divanshjohndigital 

 

It might be worth going through https://jackrabbit.apache.org/oak/docs/query/lucene.html#path-restrictions 

It allows you to create path based indexes. Exclude and include path would further help fine tune the indexes.

 

If the query is always limited under a path, a smaller and precise index would give you better results.

 

Thanks,

Aanchal


Aanchal Sikka

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hello @divanshjohndigital 

 

It might be worth going through https://jackrabbit.apache.org/oak/docs/query/lucene.html#path-restrictions 

It allows you to create path based indexes. Exclude and include path would further help fine tune the indexes.

 

If the query is always limited under a path, a smaller and precise index would give you better results.

 

Thanks,

Aanchal


Aanchal Sikka

Avatar

Community Advisor

Hi, 

 

Yes, While you are implementing it with the query builder API, 

To build a search component extending the core search component, I suggest adding the path only where you want to make the search happen, not the entire content. 

 

I hope this works

Avatar

Employee Advisor

Could you please review https://www.nextrow.com/blog/adobe-experience-manager/how-to-implement-search-components-in-aem and please consider the point below -

Refactor Oak Index definition for cqPageLucence (/oak:index/cqPageLucene) to search content tree depth level 4 and level 5.

Avatar

Community Advisor

@divanshjohndigital ,

 

Try to use predicate maps for a more efficient search. Please refer to https://hashimkhan.in/aem-adobecq5-code-templates/query-builder/.

 

using predicates you can restrict and manipulate your search depending on the requirement.

Avatar

Community Advisor

Hi @divanshjohndigital 

Your query should be something like this -

/bin/querybuilder.json?type=cq:Page&path=/content&property=jcr:title&property.value=search term&p.limit=-1

Here's a breakdown of the query parameters:

type: Specifies the type of content to search for.

path: Specifies the path to the node in the content tree where the search should start.

property: Specifies the property to search for.

property.value: Specifies the value of the property to search for.

p.limit: Specifies the maximum number of results to return. A value of -1 means that all results will be returned.


AEM has a built-in indexing system that can handle a small to medium-sized content repository. However, as the size of the content repository grows and the number of queries increases, the performance of the AEM indexing system may start to degrade. In such cases, it may be beneficial to move the index to Apache Solr, which is a highly scalable and performant search engine.