Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

AEM SQL query issue

Avatar

Level 1

Hello,

I want to search the nodes on 2 different paths. For example -> /content/AA and /content/BB. The below query works fine

 

SELECT p.* FROM [cq:PageContent] AS p WHERE ( ISDESCENDANTNODE(p,[/content/AA]) OR ISDESCENDANTNODE(p,[/content/BB]) ) AND ( CONTAINS(p.[cq:tags], ‘”testAA”) )

 

but throws the below exception in the logs

 

"org.apache.jackrabbit.oak.query.QueryImpl Fulltext query without index for filter Filter"

 

Adobe document suggests to improve the query if we get the above exception.

 

What is the best way to form a query to search in 2 different paths ? Any suggestions.

 

Thanks !!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@srajput-woolies SELECT p.* FROM [cq:PageContent] AS p WHERE ( ISDESCENDANTNODE(p,[/content/AA]) OR ISDESCENDANTNODE(p,[/content/BB]) ) , Till this level there will be no issues. 

 

Once you added contains to the query which is treating as fulltext query and showing that in the log. May be you need to relook at the index which you have in place already.

Thanks,
Siva

View solution in original post

3 Replies

Avatar

Community Advisor

@srajput-woolies :

Do you have property and fulltext indexes in your aem already, if not you need to create.

In your query you have used contains and checking against one property/ so it treats as full text query,. 

SELECT p.* FROM [cq:PageContent] AS p WHERE ( ISDESCENDANTNODE(p,[/content/AA]) OR ISDESCENDANTNODE(p,[/content/BB]) ) AND ( CONTAINS(p.[cq:tags], ‘”testAA”) )

 

Make sure that , you have created the fullest and property indexes properly . So that you will get the results quickly without traversing through several nodes.

you can check below blogs.

 

http://www.aemcq5tutorials.com/tutorials/aem-oak-indexing-comprehensive-guide/

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/removal-...

Thanks,
Siva

Avatar

Level 1

Thanks for the response.

 

We already has index for this query, which search only at one path -

 

SELECT p.* FROM [cq:PageContent] AS p WHERE ISDESCENDANTNODE(p,[/content/AA])  AND ( CONTAINS(p.[cq:tags], ‘”testAA”) )

 

But due to one of the requirement, we have to search at 2 paths now, hence we updated our query, which looks as below (ISDESCENDANTNODE with OR) 

SELECT p.* FROM [cq:PageContent] AS p WHERE ( ISDESCENDANTNODE(p,[/content/AA]) OR ISDESCENDANTNODE(p,[/content/BB]) ) AND ( CONTAINS(p.[cq:tags], ‘”testAA”) )

 

After the Query update, we get the Index exception as warning in logs.

 

Thanks!! 

Avatar

Correct answer by
Community Advisor

@srajput-woolies SELECT p.* FROM [cq:PageContent] AS p WHERE ( ISDESCENDANTNODE(p,[/content/AA]) OR ISDESCENDANTNODE(p,[/content/BB]) ) , Till this level there will be no issues. 

 

Once you added contains to the query which is treating as fulltext query and showing that in the log. May be you need to relook at the index which you have in place already.

Thanks,
Siva