Ejemplo n.º 1
0
        private static async Task RunProbeCommandAsync(SearchScorerSettings settings, HttpClient httpClient)
        {
            var credentials       = new SearchCredentials(settings.AzureSearchApiKey);
            var azureSearchClient = new SearchServiceClient(settings.AzureSearchServiceName, credentials);

            var index = await azureSearchClient.GetNuGetSearchIndexAsync(settings);

            Console.WriteLine("Running {0} tests.", GetProbeTests(settings).Count());

            foreach (var test in GetProbeTests(settings))
            {
                var searchClient   = new SearchClient(httpClient);
                var scoreEvaluator = new IREvalutation.RelevancyScoreEvaluator(searchClient);

                // Update the Azure Search index
                await azureSearchClient.UpdateNuGetSearchIndexAsync(
                    settings,
                    index,
                    test.PackageIdWeight,
                    test.TokenizedPackageIdWeight,
                    test.TagsWeight,
                    test.DownloadScoreBoost);

                // Score the new index.
                var report = await scoreEvaluator.GetCustomVariantReportAsync(
                    settings,
                    customVariantUrl : settings.TreatmentBaseUrl);

                // Save the result to the output path
                SearchProbesCsvWriter.Append(
                    settings.ProbeResultsCsvPath,
                    new SearchProbesRecord
                {
                    PackageIdWeight          = test.PackageIdWeight,
                    TokenizedPackageIdWeight = test.TokenizedPackageIdWeight,
                    TagsWeight         = test.TagsWeight,
                    DownloadScoreBoost = test.DownloadScoreBoost,

                    CuratedSearchScore       = report.CuratedSearchQueries.Score,
                    ClientCuratedSearchScore = report.ClientCuratedSearchQueries.Score,
                    FeedbackScore            = report.FeedbackSearchQueries.Score
                });
            }
        }
Ejemplo n.º 2
0
 private static async Task RunScoreCommandAsync(SearchScorerSettings settings, HttpClient httpClient)
 {
     var searchClient   = new SearchClient(httpClient);
     var scoreEvaluator = new IREvalutation.RelevancyScoreEvaluator(searchClient);
     await scoreEvaluator.RunAsync(settings);
 }