1

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.

Community
  • 1
  • 1
Bertvan
  • 4,943
  • 5
  • 40
  • 61
  • Also interested in the answer. There has to be a way since they need to do this in the content editor with the sort order field. – Derek Dysart Oct 01 '13 at 11:53
  • @ddysart: you can do this the way sitecore climber describes, but then using [IndexField("__sortorder")]. Not fully sure of the syntax here, I would have to check, but you get the point. – Bertvan Oct 01 '13 at 19:02

1 Answers1

1

you need to have mappingItem to be something like :

public class MappingItem 
{ 
 [IndexField("orderingnumberIndex")] 
 int OrderingNumber {get; set;} 
}