Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Error while executing QueryBuilder Query.

Avatar

Level 7

org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex$FulltextPathCursor Index-Traversed 20000 nodes with filter Filter(query=select [jcr:path], [jcr:score], * from [cq:Page] as a /* xpath: //element(*, cq:Page) */, path=*)

How to avoid this error.
What is wrong happing here while executing Query.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@akshaybhujbale 

 

You definitely need to optimize your query. 

  • Make sure you query in the deepest possible level in the hierarchy.
  • Get rid of p.limit=-1. You are trying to get pages in a single hit. 

Unless you are already not optimizing query based on paths, it was bound to fail, as the repository grows.

 

As a temporary solution, please go with solution 3, suggested by @sravs 

Its an OSGi config, so you would need to push it via code. 

aanchalsikka_0-1716812744931.png

 

 

 

 


Aanchal Sikka

View solution in original post

13 Replies

Avatar

Level 7

Hi @sravs Thanks for your response. 

How I can avoid this. Is there any configuration in AEM to avoid this.

Can we increases the number of nodes defined.

Avatar

Level 9

@akshaybhujbale ,

Option1: if an index has already been created for query or create a new one, try to reindex that by setting reindex = true.

Option2: update your query to execute under specified path other than executing it on the root level. 

Option3: Increase the memory limit in the OSGi configuration (Temporary fix):

Aapche Jackrabbit Query Engine Setting service -> Update the value in Memory read limit field.

Avatar

Level 7

Hi @sravs 
Option1: if an index has already been created for query or create a new one, try to reindex that by setting reindex = true.
Can you please guide me the steps and path where I can do this setting

2. Do we have access to configuration window on AEM Cloud 

Where I can update the value of 
Aapche Jackrabbit Query Engine Setting service -> Update the value in Memory read limit field. on AEM Cloud instance.

Avatar

Community Advisor

Hi @akshaybhujbale 

could you please share querybuilder query?



Arun Patidar

Avatar

Level 7

Hi @arunpatidar Thanks for your response
Below is the Query
type=cq:Page
1_group.1_path=/content/{page_path}
1_group.1_path.self=true
p.limit=-1

Avatar

Community Advisor

Hi @akshaybhujbale 

Try with 

 

type=cq:Page
path=/content/{page_path}
path.self=true
p.limit=-1



Arun Patidar

Avatar

Level 7

hi @arunpatidar 
Actually, Same query works with Another AEM instance but not for this particular instance. 
Also, We can not change the query as it is working with Multiple AEM instances and it will lead to redesign our application.

Avatar

Community Advisor

Hi @akshaybhujbale 
The issue is the query is not optimised, if the content is more on one of the instance then it will fail.

 

what are you trying to get from query?

 

if you want to list down all the pages within a tree then simply use resource iteration which will be faster and won't have any issues.

https://kiransg.com/2021/11/07/aem-iterating-node-best-practices/ 



Arun Patidar

Avatar

Correct answer by
Community Advisor

@akshaybhujbale 

 

You definitely need to optimize your query. 

  • Make sure you query in the deepest possible level in the hierarchy.
  • Get rid of p.limit=-1. You are trying to get pages in a single hit. 

Unless you are already not optimizing query based on paths, it was bound to fail, as the repository grows.

 

As a temporary solution, please go with solution 3, suggested by @sravs 

Its an OSGi config, so you would need to push it via code. 

aanchalsikka_0-1716812744931.png

 

 

 

 


Aanchal Sikka

Avatar

Level 7

Hi @akshaybhujbale 

 

Two solution you can try

1- try to increase the number or Maximum POST Paramater maybe till 2000~ http://localhost:4502/system/console/configMgr/org.apache.sling.engine.parameters

tushaar_srivastava_0-1716813855980.png

 

 

2- got to configMgr and search for "Apache Sling Main Servlet" and increase the number of calls per request

tushaar_srivastava_1-1716813939878.png

 

Let me know if that works for you.!