How do I sort my search results using item.Fields["Name"}?
var queryable = context.GetQueryable<SearchResultItem>();
queryable = queryable.OrderByDescending(x => x.Fields["MyDateField"]);
var results = queryable.GetResults();
It throws an error when I run it:
The method 'get_Item' is not supported. Declaring type: System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]. Exception: System.InvalidOperationException: variable 'x' of type 'Sitecore.ContentSearch.SearchTypes.SearchResultItem' referenced from scope '', but it is not defined
On the other hand, this works:
queryable = queryable.OrderByDescending(x => x.CreatedDate);
var results = queryable.GetResults();