Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Weird query issue

Avatar

Level 7

Hi all,

We are running into a weird situation that the same query works on one pub server, but not the other. The query has been working fine for years on both pub servers. The oak:index is the same on both. The query is:

/jcr:root/content/site//element(*,cq:PageContent)[@sling:resourceType='site/components/pages/event' and (@datestamps >= '2023-05-01' and @datestamps <= '2023-05-31') ]/eventTimes//element(*, nt:unstructured) order by @date ascending

 

Content structure is as:

 

events

   +-- test event

         +--jcr:content

             +--title

             +--datestamps

             +--eventTimes

                 +--time_1

                  |

                 +--time_2

 

Where eventTimes and time_x is nt:unstructured. The above structure shows an event has multiple event times. This query has been working for at least 6 years, and all of a sudden it stops working on one publish server. I reindexed it, no luck. If I take out the sorting condition "/eventTimes//element(*, nt:unstructured) order by @date ascending", it will work.  Any idea where I should troubleshoot?

 

Thanks a lot!

 

-kt

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @kevingtan 

 

  • Although you mentioned that the content is the same on both publish servers, check for any differences in the content that might affect the sorting. Verify that the date property values are consistent across the content nodes and that there are no variations that might cause unexpected sorting results.
  • Also, is the content size on both the publishers is exactly same? If not, may be you can ensure that the content on both the pub servers are exactly same.

View solution in original post

4 Replies

Avatar

Community Advisor

@kevingtan Are you getting error in the logs in that publish instance? Have you tried using the Explain query tool and run the query in that publish instance and see what could be the issue.

 

https://adobe-consulting-services.github.io/acs-aem-tools/features/explain-query/index.html

 

Also you can do the index consistency check 

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

 

 

 

Avatar

Community Advisor

Hi @kevingtan ,

 

Since you mentioned that after removing sorting condition "/eventTimes//element(*, nt:unstructured) order by @date ascending" it is working so I believe the issue should be because of content unavailability on that pub server. Are you getting 'No results found' on this server? Please check you have the content available.

 

Thanks,

Ritesh Mittal

 

Avatar

Level 7

Hi @Saravanan_Dharmaraj 

Yes I tried explain query, query builder, etc. Both publish servers are the same, but the actual results are different. I can try the oak-run to reindex the content.

 

Hi @Ritesh_Mittal 

The content articles are in the repository, just not showing up from the query. All properties are the same on both publish servers.

Avatar

Correct answer by
Community Advisor

Hello @kevingtan 

 

  • Although you mentioned that the content is the same on both publish servers, check for any differences in the content that might affect the sorting. Verify that the date property values are consistent across the content nodes and that there are no variations that might cause unexpected sorting results.
  • Also, is the content size on both the publishers is exactly same? If not, may be you can ensure that the content on both the pub servers are exactly same.