Hi All,
We have below full text query which is used to find pages under certain hierarchy and also with specific type of resourceType.
Sample query 1:
fulltext=random text
group.1_path=/content/us/en
group.2_path=/content/ca/en
group.p.or=true
property = jcr:content/sling:resourceType
property.1_value = project-one/components/structure/article-detail
property.2_value = project-two/components/structure/article-detail
We are getting results for above query in 300-400 milliseconds.
Now we have to bring ALL the pages under certain hierarchy and also with specific type of resourceType. (somewhat initially loading of articles on homepage) we are using same query but not using "fulltext" property.
Sample query 2:
group.1_path=/content/us/en
group.2_path=/content/ca/en
group.p.or=true
property = jcr:content/sling:resourceType
property.1_value = project-one/components/structure/article-detail
property.2_value = project-two/components/structure/article-detail
Here we are getting results in 3000-4000 milliseconds approximately 10 times to above Sample query 1.
Not sure why how much time difference. Can someone guide on same.
Solved! Go to Solution.
Views
Replies
Total Likes
I checked on both AEM6.5 as well as on AEMaaCS SDK and execution plan looks different.
And for both versions cqPageLucene is not being picked unless I specifically add the type predicate.
So, there might be some customizations done in your project to the indexes which you can possibly check.
Your first query is probably picking pathreference index due to which execution time is less.
You can use explain query tool to understand which indexes are being used for which queries
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/query...
You can try adding type=cq:Page to your second query, since you are probably trying to just identify the pages with given resourceType, it might help in reducing the execution time since then the query will pick cqPageLuceneIndex.
type=cq:Page
group.1_path=/content/us/en
group.2_path=/content/ca/en
group.p.or=true
property = jcr:content/sling:resourceType
property.1_value = project-one/components/structure/article-detail
property.2_value = project-two/components/structure/article-detail
Hope this helps.
Above queries are already picking cqPageLuceneIndex also after adding type=cq:Page no major time difference is seen.
Is it possible to share screenshots from explain query tool for both your queries ?
If same index is being picked for both your queries, it is interesting to see how the second query is taking more time.
I checked on both AEM6.5 as well as on AEMaaCS SDK and execution plan looks different.
And for both versions cqPageLucene is not being picked unless I specifically add the type predicate.
So, there might be some customizations done in your project to the indexes which you can possibly check.
I agree with @h_kataria, but just wanted to add one more thought. We have some quite complex queries on our project and cannot optimize them further. Therefore, for the ones that take a long time, we use an in-memory cache. A cache can be based on TTL if that is acceptable, or you can invalidate it with a content modification listener.
Good luck,
Daniel
@daniel-strmecki yeah caching probably would be the last option for me. I am just curious to know why fulltext= "random text" and fulltext = " " take so much time difference. Both are using cqPageLuceneIndex in my case. Not sure I should add some extra parameters for empty string search
@AkshayWa2 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies