< Summary

Class:Microsoft.Azure.Search.Models.DistanceScoringFunction
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\DistanceScoringFunction.Customization.cs
C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\DistanceScoringFunction.cs
Covered lines:17
Uncovered lines:1
Coverable lines:18
Total lines:115
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\DistanceScoringFunction.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 DistanceScoringFunction
 11    {
 12        /// <summary>
 13        /// Initializes a new instance of the DistanceScoringFunction class.
 14        /// </summary>
 15        public DistanceScoringFunction(
 16            string fieldName,
 17            double boost,
 18            string referencePointParameter,
 19            double boostingDistance,
 20            ScoringFunctionInterpolation? interpolation = default(ScoringFunctionInterpolation?))
 9421            : this(
 9422                fieldName,
 9423                boost,
 9424                new DistanceScoringParameters(referencePointParameter, boostingDistance),
 9425                interpolation)
 26        {
 27            // Other constructor handles all initialization.
 9428        }
 29    }
 30}

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\DistanceScoringFunction.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 distance from a
 19    /// geographic location.
 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("distance")]
 25    public partial class DistanceScoringFunction : ScoringFunction
 26    {
 27        /// <summary>
 28        /// Initializes a new instance of the DistanceScoringFunction class.
 29        /// </summary>
 48630        public DistanceScoringFunction()
 31        {
 32            CustomInit();
 48633        }
 34
 35        /// <summary>
 36        /// Initializes a new instance of the DistanceScoringFunction 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 distance 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 DistanceScoringFunction(string fieldName, double boost, DistanceScoringParameters parameters, ScoringFunc
 47849            : base(fieldName, boost, interpolation)
 50        {
 47851            Parameters = parameters;
 52            CustomInit();
 47853        }
 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 distance scoring function.
 62        /// </summary>
 63        [JsonProperty(PropertyName = "distance")]
 290464        public DistanceScoringParameters 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        {
 48074            base.Validate();
 48075            if (Parameters == null)
 76            {
 077                throw new ValidationException(ValidationRules.CannotBeNull, "Parameters");
 78            }
 48079            if (Parameters != null)
 80            {
 48081                Parameters.Validate();
 82            }
 48083        }
 84    }
 85}