Weird query issue | Community
Skip to main content
Level 5
June 16, 2023
Solved

Weird query issue

  • June 16, 2023
  • 3 replies
  • 1065 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Tanika02

Hello @kevin_gta 

 

  • 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.

3 replies

Saravanan_Dharmaraj
Community Advisor
Community Advisor
June 16, 2023

@kevin_gta 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-run-jar-to-manage-indexes.html?lang=en#index-consistency-check

 

 

 

Ritesh_Mittal
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 16, 2023

Hi @kevin_gta ,

 

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

 

Kevin_GTaAuthor
Level 5
June 16, 2023

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.

Tanika02
Tanika02Accepted solution
Level 7
June 18, 2023

Hello @kevin_gta 

 

  • 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.