AEM Search Component | Community
Skip to main content
January 30, 2023
Solved

AEM Search Component

  • January 30, 2023
  • 5 replies
  • 3139 views

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.

Best answer by aanchal-sikka

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

5 replies

aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
January 30, 2023

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
partyush
Community Advisor
Community Advisor
January 30, 2023

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

DEBAL_DAS
January 30, 2023

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.

sravs
Community Advisor
Community Advisor
January 30, 2023

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

Nitin_laad
Community Advisor
Community Advisor
January 30, 2023

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.