Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

All scores are null. Why?

Vote:
 

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. 

#270692
Jan 27, 2022 14:38
Vote:
 

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.

#270771
Jan 28, 2022 15:18
Vote:
 

Hi!

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!

#270773
Jan 28, 2022 15:22
Vote:
 

Hmm

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")));
}
#270776
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.