Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
One of the things I'm using Examine for is for retrieving the x most recent content for a particular nodetypealias. However, IQuery.OrderByDescending() on the "createDate" field does not seem to be working correctly, at least on dates.
ISearchCriteria searchCriteria = searcher.CreateSearchCriteria(IndexTypes.Content); IBooleanOperation query = searchCriteria.NodeTypeAlias("myAlias"); query = query.And().OrderByDescending("createDate"); ISearchResults results = searcher.Search(query.Compile(), max);
For example, the nodes with these two dates:
2016-04-26T20:17:46 2016-05-01T18:54:05
are always returned in that order.
I'm using Umbraco 7.4.2
Mahgo,
See https://our.umbraco.org/forum/developers/api-questions/75407-how-in-gods-name-do-you-sort-by-date-using-examine
I dont think modifying config will sort it but you can try however using document writing event to inject in sortable date will as I have done this.
Regards
Ismial
Thanks Ismail,
Adding EnableSorting="true" to the particular field in IndexAttributeFields was what I needed to get it working!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Examine OrderByDescending CreateDate not working
One of the things I'm using Examine for is for retrieving the x most recent content for a particular nodetypealias. However, IQuery.OrderByDescending() on the "createDate" field does not seem to be working correctly, at least on dates.
For example, the nodes with these two dates:
are always returned in that order.
I'm using Umbraco 7.4.2
Mahgo,
See https://our.umbraco.org/forum/developers/api-questions/75407-how-in-gods-name-do-you-sort-by-date-using-examine
I dont think modifying config will sort it but you can try however using document writing event to inject in sortable date will as I have done this.
Regards
Ismial
Thanks Ismail,
Adding EnableSorting="true" to the particular field in IndexAttributeFields was what I needed to get it working!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.