I have some items present in an item folder and want them to retrieve from Lucence index. There is a requirement that we have to order items in the Sitecore based on the order set on the Sitecore CMS, I have to retrieve them and show on the page.
Here I'm using content search API and in the search query, I'm passing sort options based on the sortorder as below.
#region Sort Options
SortOption sortOption = new SortOption() { SortFieldName = "__sortorder", SortOrder = SortOrder.Ascending };
#endregion
I did the indexing but the results are partially order by sort order field for example, I have set order as 1,2,3,4,5,6,7,8,9,10,11,12,13,14 Output of the items coming as : 1,10,11,12,13,14,2,3,4,5,6,....
Also tried another option, I have added the sort order field in my search model as below to do sort based upon the field value
[JsonProperty]
[IndexField("__sortorder")]
public string sortOrder { get; set; }
But in output the sort order field value is coming but with Pipe (|) appended as shown below:
Please suggest a way to retrieve the Sitecore items based on the sortorder field from the lucene indexes