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
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.
Still wondering - any suggestions. Thanks
You can use the following extension for sorting by score: https://gist.github.com/lindstromhenrik/9779858Best Regards,
Cheers - that looks pretty useful. I will check that out when I get a moment
Any luck with what you did? I'm looking for implementing something similar.
We are using it and it works:
results = results.OrderBy(x => x.SomeField).ThenByScore();
I was bold - tried it out and came to the same conclusion. Thanks Henrik et al.