< Summary

Class:Microsoft.Azure.Search.Models.MagnitudeScoringFunction
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\MagnitudeScoringFunction.Customization.cs
C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\MagnitudeScoringFunction.cs
Covered lines:17
Uncovered lines:1
Coverable lines:18
Total lines:116
Line coverage:94.4% (17 of 18)
Covered branches:3
Total branches:4
Branch coverage:75% (3 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
get_Parameters()-100%100%
Validate()-83.33%75%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\MagnitudeScoringFunction.Customization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.Search.Models
 6{
 7    using Microsoft.Rest;
 8    using Newtonsoft.Json;
 9
 10    public partial class MagnitudeScoringFunction
 11    {
 12        /// <summary>
 13        /// Initializes a new instance of the MagnitudeScoringFunction class.
 14        /// </summary>
 15        public MagnitudeScoringFunction(
 16            string fieldName,
 17            double boost,
 18            double boostingRangeStart,
 19            double boostingRangeEnd,
 20            bool? shouldBoostBeyondRangeByConstant = default(bool?),
 21            ScoringFunctionInterpolation? interpolation = default(ScoringFunctionInterpolation?))
 9622            : this(
 9623                fieldName,
 9624                boost,
 9625                new MagnitudeScoringParameters(boostingRangeStart, boostingRangeEnd, shouldBoostBeyondRangeByConstant),
 9626                interpolation)
 27        {
 28            // Initialization done by the other constructor.
 9629        }
 30    }
 31}

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\MagnitudeScoringFunction.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.Linq;
 16
 17    /// <summary>
 18    /// Defines a function that boosts scores based on the magnitude of a
 19    /// numeric field.
 20    /// <see
 21    /// href="https://docs.microsoft.com/rest/api/searchservice/Add-scoring-profiles-to-a-search-index"
 22    /// />
 23    /// </summary>
 24    [Newtonsoft.Json.JsonObject("magnitude")]
 25    public partial class MagnitudeScoringFunction : ScoringFunction
 26    {
 27        /// <summary>
 28        /// Initializes a new instance of the MagnitudeScoringFunction class.
 29        /// </summary>
 26630        public MagnitudeScoringFunction()
 31        {
 32            CustomInit();
 26633        }
 34
 35        /// <summary>
 36        /// Initializes a new instance of the MagnitudeScoringFunction class.
 37        /// </summary>
 38        /// <param name="fieldName">The name of the field used as input to the
 39        /// scoring function.</param>
 40        /// <param name="boost">A multiplier for the raw score. Must be a
 41        /// positive number not equal to 1.0.</param>
 42        /// <param name="parameters">Parameter values for the magnitude scoring
 43        /// function.</param>
 44        /// <param name="interpolation">A value indicating how boosting will be
 45        /// interpolated across document scores; defaults to "Linear". Possible
 46        /// values include: 'linear', 'constant', 'quadratic',
 47        /// 'logarithmic'</param>
 48        public MagnitudeScoringFunction(string fieldName, double boost, MagnitudeScoringParameters parameters, ScoringFu
 28449            : base(fieldName, boost, interpolation)
 50        {
 28451            Parameters = parameters;
 52            CustomInit();
 28453        }
 54
 55        /// <summary>
 56        /// An initialization method that performs custom operations like setting defaults
 57        /// </summary>
 58        partial void CustomInit();
 59
 60        /// <summary>
 61        /// Gets or sets parameter values for the magnitude scoring function.
 62        /// </summary>
 63        [JsonProperty(PropertyName = "magnitude")]
 170064        public MagnitudeScoringParameters Parameters { get; set; }
 65
 66        /// <summary>
 67        /// Validate the object.
 68        /// </summary>
 69        /// <exception cref="ValidationException">
 70        /// Thrown if validation fails
 71        /// </exception>
 72        public override void Validate()
 73        {
 27274            base.Validate();
 27275            if (Parameters == null)
 76            {
 077                throw new ValidationException(ValidationRules.CannotBeNull, "Parameters");
 78            }
 27279            if (Parameters != null)
 80            {
 27281                Parameters.Validate();
 82            }
 27283        }
 84    }
 85}