< Summary

Class:Microsoft.Azure.Search.Models.ScoringProfile
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\ScoringProfile.cs
Covered lines:20
Uncovered lines:1
Coverable lines:21
Total lines:120
Line coverage:95.2% (20 of 21)
Covered branches:9
Total branches:10
Branch coverage:90% (9 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_TextWeights()-100%100%
get_Functions()-100%100%
get_FunctionAggregation()-100%100%
Validate()-88.89%90%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\ScoringProfile.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.Search.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// Defines parameters for a search index that influence scoring in search
 21    /// queries.
 22    /// <see
 23    /// href="https://docs.microsoft.com/rest/api/searchservice/Add-scoring-profiles-to-a-search-index"
 24    /// />
 25    /// </summary>
 26    public partial class ScoringProfile
 27    {
 28        /// <summary>
 29        /// Initializes a new instance of the ScoringProfile class.
 30        /// </summary>
 75231        public ScoringProfile()
 32        {
 33            CustomInit();
 75234        }
 35
 36        /// <summary>
 37        /// Initializes a new instance of the ScoringProfile class.
 38        /// </summary>
 39        /// <param name="name">The name of the scoring profile.</param>
 40        /// <param name="textWeights">Parameters that boost scoring based on
 41        /// text matches in certain index fields.</param>
 42        /// <param name="functions">The collection of functions that influence
 43        /// the scoring of documents.</param>
 44        /// <param name="functionAggregation">A value indicating how the
 45        /// results of individual scoring functions should be combined.
 46        /// Defaults to "Sum". Ignored if there are no scoring functions.
 47        /// Possible values include: 'sum', 'average', 'minimum', 'maximum',
 48        /// 'firstMatching'</param>
 76249        public ScoringProfile(string name, TextWeights textWeights = default(TextWeights), IList<ScoringFunction> functi
 50        {
 76251            Name = name;
 76252            TextWeights = textWeights;
 76253            Functions = functions;
 76254            FunctionAggregation = functionAggregation;
 55            CustomInit();
 76256        }
 57
 58        /// <summary>
 59        /// An initialization method that performs custom operations like setting defaults
 60        /// </summary>
 61        partial void CustomInit();
 62
 63        /// <summary>
 64        /// Gets or sets the name of the scoring profile.
 65        /// </summary>
 66        [JsonProperty(PropertyName = "name")]
 309867        public string Name { get; set; }
 68
 69        /// <summary>
 70        /// Gets or sets parameters that boost scoring based on text matches in
 71        /// certain index fields.
 72        /// </summary>
 73        [JsonProperty(PropertyName = "text")]
 270674        public TextWeights TextWeights { get; set; }
 75
 76        /// <summary>
 77        /// Gets or sets the collection of functions that influence the scoring
 78        /// of documents.
 79        /// </summary>
 80        [JsonProperty(PropertyName = "functions")]
 536681        public IList<ScoringFunction> Functions { get; set; }
 82
 83        /// <summary>
 84        /// Gets or sets a value indicating how the results of individual
 85        /// scoring functions should be combined. Defaults to "Sum". Ignored if
 86        /// there are no scoring functions. Possible values include: 'sum',
 87        /// 'average', 'minimum', 'maximum', 'firstMatching'
 88        /// </summary>
 89        [JsonProperty(PropertyName = "functionAggregation")]
 386090        public ScoringFunctionAggregation? FunctionAggregation { get; set; }
 91
 92        /// <summary>
 93        /// Validate the object.
 94        /// </summary>
 95        /// <exception cref="ValidationException">
 96        /// Thrown if validation fails
 97        /// </exception>
 98        public virtual void Validate()
 99        {
 752100            if (Name == null)
 101            {
 0102                throw new ValidationException(ValidationRules.CannotBeNull, "Name");
 103            }
 752104            if (TextWeights != null)
 105            {
 90106                TextWeights.Validate();
 107            }
 752108            if (Functions != null)
 109            {
 3368110                foreach (var element in Functions)
 111                {
 932112                    if (element != null)
 113                    {
 932114                        element.Validate();
 115                    }
 116                }
 117            }
 752118        }
 119    }
 120}