Reputation: 5033
When using the new Search API (ContentSearchManager.GetIndex...)
, how can we sort the result by a numeric field. When using default .OrderBy()
, then the field is sorted by the string representation of these numbers.
This means that the order is like:
1, 10, 11, 2, 3, 4, 5...
How can we instruct SiteCore to sort this field as a number?
I have found a answer on how to do this in 6.5, but we are using 7.
Upvotes: 1
Views: 481
Reputation:
you need to have mappingItem to be something like :
public class MappingItem
{
[IndexField("orderingnumberIndex")]
int OrderingNumber {get; set;}
}
Upvotes: 1