Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

orderby=@jcr:content/cq:lastModified is not returning result in sorted order.

Umesh_Thakur
Community Advisor
Community Advisor

Dear Members,

I am using below query to get the modified pages based on its last modification date and time.

path = /content/my-project/www/language-masters/en_ca
type=cq:Page
orderby=@jcr:content/cq:lastModified
orderby.sort=desc
p.limit=-1

It means last modified page should be displayed on the top of the result, returned by the query. but it is not returning data in the proper order.

In some of the environment it is working as expected but in one of my instance, we are facing the issue. 

Any thoughts on it?

 

Thanks

Umesh Thakur 

5 Replies
Bhuwan_B
Community Advisor
Community Advisor

@Umesh_Thakur Your query looks fine to me and it works fine when I tested it. Is their any specific error you are seeing in the instance you are testing ?

https://hashimkhan.in/2017/10/09/digest-the-query-builder-api-aem-search-tips/

Umesh_Thakur
Community Advisor
Community Advisor

No Bhuwan, not any specific error I can see in logs.

Issue is only with Ordering.

Vijayalakshmi_S
Community Advisor
Community Advisor

Hi @Umesh_Thakur,

Could you please execute the query in "Explain Query" in all the instances and confirm if it all uses cqPageLucene (Per the query shared, it should use OOTB cqPageLucene)

If it is the same in all instances, cross check if this node /oak:index/cqPageLucene/indexRules/cq:Page/properties/cqLastModified has ordered property [Boolean] set to true.

(It should be there OOTB, just a cross check if project is using custom Index and/or any specific property definition)

 

Is it possible for you to share specific case (with date values) where you see the discrepancy in the order.  

 

Umesh_Thakur
Community Advisor
Community Advisor

Thanks for the response @Vijayalakshmi_S,

Yes it is using cqPageLucene Index only in all the instances and I can see ordered property is true as well.

Please see the below image:

Working fine:

Umesh_Thakur_0-1629262944550.png

 

Not working:

Umesh_Thakur_1-1629263050861.png

 

in the last image, you can see pages modified this year, are coming third or forth position. that is the issue.

Date is in mm/dd/yyyy format.

we are displaying queried data in a html page. same result we are getting in query builder.

Vijayalakshmi_S
Community Advisor
Community Advisor

Hi @Umesh_Thakur,

Thanks for sharing screenshots. I tried reproducing this in my local(used the date values as it is in not working scenario) and it works fine.

Could you please let know

  • If the order mismatch is occurring even when executed in Query Debugger - http://localhost:4502/libs/cq/search/content/querydebug.html
  • If this implementation is already available + is working before and not working now in some instances?
    • If yes, was there any activity in the problematic instance related to custom index definition or anything related.