< Summary

Class:Azure.Search.Documents.Indexes.Models.PhoneticTokenFilter
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PhoneticTokenFilter.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PhoneticTokenFilter.Serialization.cs
Covered lines:0
Uncovered lines:42
Coverable lines:42
Total lines:112
Line coverage:0% (0 of 42)
Covered branches:0
Total branches:18
Branch coverage:0% (0 of 18)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_Encoder()-0%100%
get_ReplaceOriginalTokens()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializePhoneticTokenFilter(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PhoneticTokenFilter.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9
 10namespace Azure.Search.Documents.Indexes.Models
 11{
 12    /// <summary> Create tokens for phonetic matches. This token filter is implemented using Apache Lucene. </summary>
 13    public partial class PhoneticTokenFilter : TokenFilter
 14    {
 15        /// <summary> Initializes a new instance of PhoneticTokenFilter. </summary>
 16        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 17        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
 018        public PhoneticTokenFilter(string name) : base(name)
 19        {
 020            if (name == null)
 21            {
 022                throw new ArgumentNullException(nameof(name));
 23            }
 24
 025            ODataType = "#Microsoft.Azure.Search.PhoneticTokenFilter";
 026        }
 27
 28        /// <summary> Initializes a new instance of PhoneticTokenFilter. </summary>
 29        /// <param name="oDataType"> Identifies the concrete type of the token filter. </param>
 30        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 31        /// <param name="encoder"> The phonetic encoder to use. Default is &quot;metaphone&quot;. </param>
 32        /// <param name="replaceOriginalTokens"> A value indicating whether encoded tokens should replace original token
 033        internal PhoneticTokenFilter(string oDataType, string name, PhoneticEncoder? encoder, bool? replaceOriginalToken
 34        {
 035            Encoder = encoder;
 036            ReplaceOriginalTokens = replaceOriginalTokens;
 037            ODataType = oDataType ?? "#Microsoft.Azure.Search.PhoneticTokenFilter";
 038        }
 39
 40        /// <summary> The phonetic encoder to use. Default is &quot;metaphone&quot;. </summary>
 041        public PhoneticEncoder? Encoder { get; set; }
 42        /// <summary> A value indicating whether encoded tokens should replace original tokens. If false, encoded tokens
 043        public bool? ReplaceOriginalTokens { get; set; }
 44    }
 45}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PhoneticTokenFilter.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.Search.Documents.Indexes.Models
 12{
 13    public partial class PhoneticTokenFilter : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (Optional.IsDefined(Encoder))
 19            {
 020                writer.WritePropertyName("encoder");
 021                writer.WriteStringValue(Encoder.Value.ToSerialString());
 22            }
 023            if (Optional.IsDefined(ReplaceOriginalTokens))
 24            {
 025                writer.WritePropertyName("replace");
 026                writer.WriteBooleanValue(ReplaceOriginalTokens.Value);
 27            }
 028            writer.WritePropertyName("@odata.type");
 029            writer.WriteStringValue(ODataType);
 030            writer.WritePropertyName("name");
 031            writer.WriteStringValue(Name);
 032            writer.WriteEndObject();
 033        }
 34
 35        internal static PhoneticTokenFilter DeserializePhoneticTokenFilter(JsonElement element)
 36        {
 037            Optional<PhoneticEncoder> encoder = default;
 038            Optional<bool> replace = default;
 039            string odataType = default;
 040            string name = default;
 041            foreach (var property in element.EnumerateObject())
 42            {
 043                if (property.NameEquals("encoder"))
 44                {
 045                    encoder = property.Value.GetString().ToPhoneticEncoder();
 046                    continue;
 47                }
 048                if (property.NameEquals("replace"))
 49                {
 050                    replace = property.Value.GetBoolean();
 051                    continue;
 52                }
 053                if (property.NameEquals("@odata.type"))
 54                {
 055                    odataType = property.Value.GetString();
 056                    continue;
 57                }
 058                if (property.NameEquals("name"))
 59                {
 060                    name = property.Value.GetString();
 61                    continue;
 62                }
 63            }
 064            return new PhoneticTokenFilter(odataType, name, Optional.ToNullable(encoder), Optional.ToNullable(replace));
 65        }
 66    }
 67}