Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

AEM 6.5 Query Builder or CRX Query Tool not returning results for local environments

Avatar

Level 1

I am experiencing a weird issue, for some pieces of the content in some of our author local development environments we are getting no results for the queries.

Exactly the same queries are returning valid results in other local development environments and in DEV and STAGE ones as well.

My first guess is that it could a permissions issue, but locally we are using the admin user which should have full permissions over all the nodes.

The following is part of the query in XPATH version, it is not a complex query:

 

 

/jcr:root/[content_path]/jcr:content//*[(@sling:resourceType = '[component_resource_type]')]

 

 

I even tried creating content packages from the environments where it is working fine and installing in my local environment without luck.

I would focus on debugging the code further(despite I already did without luck) but the fact that it does not return any result in the CRX query tool neither, indicates me the problem should not be in the code.

Also I already reviewd the query plans and there is not difference between it in a working environment and my local environment.

Also I tried an offline reindex with the oak tool and nothing changed.

Has anyone experienced something like that?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @jovidiaz,

As you are completely sure that it is not permission issue, I suggest to give a try on the below. 

 

Create a logger entry for the following in debug level in http://localhost:4502/system/console/slinglog

org.apache.jackrabbit.oak.query.QueryEngineImpl
org.apache.jackrabbit.oak.query.SQL2Parser
org.apache.jackrabbit.oak.query.QueryImpl
com.day.cq.search
org.apache.jackrabbit.oak.query

Vijayalakshmi_S_0-1620395565297.png

Also, Execute your query in Query Performance tool(http://localhost:4502/libs/granite/operations/content/diagnosistools/queryPerformance.html) and arrive at Index used. Try to reindex only that specific index by updating the property "reindex" to true and wait for some time to see the property updated to false and reindexCount update to next incremented value upon successful reindexing. (Refresh the index node after some time to see the property values updated automatically upon successful reindex)

Vijayalakshmi_S_0-1620396537520.png

 

Example: For the sample query you posted, ntBaseLucene is the index used. You can reindex only that particular index - /oak:index/ntBaseLucene

Note : Given that it is your local environment, you can reindex directly like this. 

 

Logs statements are displayed here and you can also check detailed trace from Sling Log as mentioned above. 

Vijayalakshmi_S_1-1620396361759.png

View solution in original post

9 Replies

Avatar

Community Advisor

Hi @jovidiaz 

 

Have you tried to reindex using the oak tool using the steps mentioned here:

https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/administration/use-oak-r...

 

If still this did not resolve the issue, try to copy the index from the working instance and put it on your instance and retry.

asutosh_jena_0-1620358423286.png

 

Thanks!

Avatar

Level 1

Hello, thanks for your help.

I already tried to reindex without luck.

 

Also I am trying to export/import the index using the dump operation, but I am not sure if that is what you suggested.

 

Can you point me to one example of how to do what you mentioned: "try to copy the index from the working instance and put it on your instance" ?

 

Thanks in advance,

Avatar

Community Advisor

Hi @jovidiaz 

 

Oak index will be stored under /oak:index in repository. You can package it from working instance and install it in the non working instance.

 

asutosh_jena_0-1620358397201.png

 

Thanks!

Avatar

Level 1
Hello @Asutosh_Jena_, For some reason create a package for that path always generated an empty package for me. Thanks anyways

Avatar

Correct answer by
Community Advisor

Hi @jovidiaz,

As you are completely sure that it is not permission issue, I suggest to give a try on the below. 

 

Create a logger entry for the following in debug level in http://localhost:4502/system/console/slinglog

org.apache.jackrabbit.oak.query.QueryEngineImpl
org.apache.jackrabbit.oak.query.SQL2Parser
org.apache.jackrabbit.oak.query.QueryImpl
com.day.cq.search
org.apache.jackrabbit.oak.query

Vijayalakshmi_S_0-1620395565297.png

Also, Execute your query in Query Performance tool(http://localhost:4502/libs/granite/operations/content/diagnosistools/queryPerformance.html) and arrive at Index used. Try to reindex only that specific index by updating the property "reindex" to true and wait for some time to see the property updated to false and reindexCount update to next incremented value upon successful reindexing. (Refresh the index node after some time to see the property values updated automatically upon successful reindex)

Vijayalakshmi_S_0-1620396537520.png

 

Example: For the sample query you posted, ntBaseLucene is the index used. You can reindex only that particular index - /oak:index/ntBaseLucene

Note : Given that it is your local environment, you can reindex directly like this. 

 

Logs statements are displayed here and you can also check detailed trace from Sling Log as mentioned above. 

Vijayalakshmi_S_1-1620396361759.png

Avatar

Level 1

Hello @Vijayalakshmi_S, I was sure it was not a permission issue because I was getting the same issue executing the query in the CRX query tool with the super admin user. But doing the reindex in the way you explained fixed the issue for me. 

I am not sure why it was not fixed when I ran a full reindex with the oak tool but it is working now.

Thanks so much for your help!

Avatar

Community Advisor

Hi @jovidiaz,

Just realized from my screenshot in previous answer that the result count is 0. (After posting the answer :()

Ignore my previous answer with respect to Query Performance. (You can consider Logger entry)

Issue is with the query. path shouldn't be with jcr:content in this case because there won't be any further nodes (under jcr:content) which has the sling:resourceType to be the one(weretail/components/structure/page) that we are looking for.

Here is the correct query with screenshot

Vijayalakshmi_S_0-1620397117736.png