Search code examples
c#azure-cognitive-search

Bring back the Default Search Score as part of a document


When I search using the Azure Search Portal, I get an extra field called: "@search.score" for each document pulled back from the Search Index.

But I couldn't find any documentation about how to get that value for each row when we make use of the .NET SDK

Example:

Search using Azure Search Portal

We are using the default score profile for testing purposes.

Thanks!


Solution

  • The document score is a property of the SearchResult class: https://learn.microsoft.com/dotnet/api/microsoft.azure.search.models.searchresult-1.score?view=azure-dotnet#Microsoft_Azure_Search_Models_SearchResult_1_Score

    Instances of this class wrap each document that is returned in the results from the Search API.