November Happy Hour will be moved to Thursday December 5th.

Custom calculated sorting

Vote:
 

Hi, is there any way to these kind of things:

var result = this.findClient
	.Search()
	.OrderBy(content => content.SortTimeTicks - DateTime.UtcNow.Ticks < 0 
		? (content.SortTimeTicks - DateTime.UtcNow.Ticks) * -1 
		: content.SortTimeTicks - DateTime.UtcNow.Ticks)
	.GetContentResult();


i.e. on the fly calculations manipulating the sort order.

/Regard Niklas

#176230
Mar 14, 2017 10:12
Vote:
 

Hi Niklas I assume you're trying to get a random order to the search results?

There is a NuGet package that does this - http://nuget.episerver.com/en/OtherPages/Package/?packageId=Random2Find

#176738
Mar 24, 2017 10:39
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.