Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Ordering by term then by relevance



I need to band a set of results so that there are a number of custom bandings (represented by a numeric search priority) then ordered by relevance within that band. So far I have got 

ITypeSearch<ProductPageBase> result = resultsBase.OrderBy(x => x.SearchPriorityEffective);

to do this. Unfortunately this bands the results but destroys the relevance ordering within that banding. What would be ideal is if I could go

ITypeSearch<ProductPageBase> result = resultsBase.OrderBy(x => x.SearchPriorityEffective).ThenBy(x => x.Relevance);

but i can't see anywhere that the relevance of the search result is directly exposed. Does anyone know of a way to achieve this kind of sirting in find i.e. CustomSort -> then by -> relevance of the search results

Many Thanks for any all help




Feb 05, 2014 12:08

I notice that search hit has a nullable double for score but this is only available after a call to GetResults

I need that exposed on the order by query. 

Any suggestions????

Feb 10, 2014 11:30

Still wondering - any suggestions. Thanks

Mar 21, 2014 10:27


You can use the following extension for sorting by score:

Best Regards,


Mar 26, 2014 10:48

Cheers - that looks pretty useful. I will check that out when I get a moment

Mar 27, 2014 12:53

Hi Tim!

Any luck with what you did? I'm looking for implementing something similar.


Nov 17, 2014 7:25

Hi Jonathan,

We are using it and it works:

                results = results.OrderBy(x => x.SomeField).ThenByScore();

Nov 17, 2014 11:59

Hi David,

I was bold - tried it out and came to the same conclusion. Thanks Henrik et al.


Nov 17, 2014 12:07
* 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.