Adding scoring profile in a search query using Azure Cognitive Search client library for .NET

Kirti Chaturvedi 116 Reputation points Microsoft Employee
2023-06-14T23:13:41.31+00:00

I have a indexer created in Azure cognitiveSearch, I have also created a default scoring profile in azure portal for that indexer. Now I want to use the client to set up a tag based scoring profile where I want to boost the score where

"func1-val1", "func2-val2", "func3-val3"

.These 3 values are defined as a function in my azure portal default scoring profile(attached screenshot).

In my code I am calling the search method of this client with the scoring parameters passed as option values

SearchOptions options = new SearchOptions
            {
                SearchMode = SearchMode.All,
                Filter = filters,
                Size = 10000,

            };


            options.GetType().GetProperty("ScoringParameters").SetValue(options, 
                new List
Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,342 questions
Developer technologies | .NET | Other
0 comments No comments
{count} votes

Accepted answer
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-06-16T08:00:25.2633333+00:00

    Thanks for posting this question. I'm checking on this and will get back to you shortly.

    It looks like you missed adding the screenshot. In the interim, kindly take a look at FeaturesMode: Relevance and scoring - Azure Cognitive Search | Microsoft Learn to know about scoring per field basis which may help to determine better boosting values.

    Edited:

    Kirti Chaturvedi resolved the issue after setting this option

    options.GetType().GetProperty("ScoringStatistics").SetValue(options, ScoringStatistics.Global);
    
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.