Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Ordering by term then by relevance

Vote:
 

Hi

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

       

 

 

#80937
Feb 05, 2014 12:08
Vote:
 

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

http://find.episerver.com/Documentation/dotnet-api-searching

I need that exposed on the order by query. 

Any suggestions????

#81096
Feb 10, 2014 11:30
Vote:
 

Still wondering - any suggestions. Thanks

#82907
Mar 21, 2014 10:27
Vote:
 

Hi,

You can use the following extension for sorting by score: https://gist.github.com/lindstromhenrik/9779858

Best Regards,

Henrik

#83124
Mar 26, 2014 10:48
Vote:
 

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

#83197
Mar 27, 2014 12:53
Vote:
 

Hi Tim!

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

//Jonathan

#113236
Nov 17, 2014 7:25
Vote:
 

Hi Jonathan,

We are using it and it works:

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

#113257
Nov 17, 2014 11:59
Vote:
 

Hi David,

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

 

#113258
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.