All scores are null. Why?


I have a project that uses UnifiedSearch. The result from a search looks OK, but all hits are missing the Score. They all have null value as Score. Is this even possible? I thought all hits always have a score. 

I wanted to do some boosting but when the score is null, it's a bit difficult to boost the score. 

Jan 27, 2022 14:38

Hi Jocke

Are you performing any free-text search in your query? I.e. .For(query);
Boosting only has an effect if there is an existing score to boost.

Jan 28, 2022 15:18


I found the answer myself just now! If I have OrderBy() in my statement the Scores are set to null. As soon as I remove the OrderBy all hits will have a score!

Jan 28, 2022 15:22


Maybe you have to do "OrderByRelevance" which is the default.

You could perhaps add

public static ITypeSearch<TSource> OrderByScore<TSource>(this ITypeSearch<TSource> search)
    return new Search<TSource, IQuery>(search, context =>
    context.RequestBody.Sort.Add(new Sorting("_score")));
Jan 28, 2022 15: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.