Sorting issue in Episerver Find 13.0.1
We have known an issue about sorting in Find 13.0.1 that we can reproduce
- Create a developer index in find.episerver.com.
- Create some properties for string, DateTime, int type for a page type
- Create some page using those page types.
- Run the site and index the content.
- In the test page, create query and sort by Date or SortNumber.
var query = _searchClient.Search<BasePage>()
.FilterForVisitor()
.OrderBy(x => x.MyOwnDate)
.Select(x => new SearchItem
{
PageTitle = x.Name,
MyOwnDate = x.MyOwnDate,
SortNumber = x.SortNumber,
TeaserText = x.TeaserText,
ID = x.ContentLink.ID
})
.Take(100);
model.SearchResults = query.GetResult().Hits.Select(x => x.Document).ToList();
And the bug is published https://world.episerver.com/support/Bug-list/bug/FIND-3596 and will be fixed in next version.
While waiting for upgrading to the next version, we can have a way of working around:
.OrderBy(x => x.MyOwnDate, null, null, false);
// Or
.OrderBy(x => x.MyOwnDate, null, SortOrder.Ascending, false);
// For order descending, we had:
.OrderBy(x => x.MyOwnDate, null, SortOrder.Descending, false);
We need to change OrderBy clause and make sure that the ignoreUnmapped parameter is false.
We can apply the same working around for other types: date, int, ...
Hope this helps your work.
/Son Do
Comments