< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_IgnoreCase()-0%100%
get_Expand()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeSynonymTokenFilter(...)-0%0%
get_Synonyms()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SynonymTokenFilter.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;
 9using System.Collections.Generic;
 10using System.Linq;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    /// <summary> Matches single or multi-word synonyms in a token stream. This token filter is implemented using Apache
 15    public partial class SynonymTokenFilter : TokenFilter
 16    {
 17        /// <summary> Initializes a new instance of SynonymTokenFilter. </summary>
 18        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 19        /// <param name="synonyms"> A list of synonyms in following one of two formats: 1. incredible, unbelievable, fab
 20        /// <exception cref="ArgumentNullException"> <paramref name="name"/> or <paramref name="synonyms"/> is null. </e
 021        public SynonymTokenFilter(string name, IEnumerable<string> synonyms) : base(name)
 22        {
 023            if (name == null)
 24            {
 025                throw new ArgumentNullException(nameof(name));
 26            }
 027            if (synonyms == null)
 28            {
 029                throw new ArgumentNullException(nameof(synonyms));
 30            }
 31
 032            Synonyms = synonyms.ToList();
 033            ODataType = "#Microsoft.Azure.Search.SynonymTokenFilter";
 034        }
 35
 36        /// <summary> Initializes a new instance of SynonymTokenFilter. </summary>
 37        /// <param name="oDataType"> Identifies the concrete type of the token filter. </param>
 38        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 39        /// <param name="synonyms"> A list of synonyms in following one of two formats: 1. incredible, unbelievable, fab
 40        /// <param name="ignoreCase"> A value indicating whether to case-fold input for matching. Default is false. </pa
 41        /// <param name="expand"> A value indicating whether all words in the list of synonyms (if =&gt; notation is not
 042        internal SynonymTokenFilter(string oDataType, string name, IList<string> synonyms, bool? ignoreCase, bool? expan
 43        {
 044            Synonyms = synonyms;
 045            IgnoreCase = ignoreCase;
 046            Expand = expand;
 047            ODataType = oDataType ?? "#Microsoft.Azure.Search.SynonymTokenFilter";
 048        }
 49        /// <summary> A value indicating whether to case-fold input for matching. Default is false. </summary>
 050        public bool? IgnoreCase { get; set; }
 51        /// <summary> A value indicating whether all words in the list of synonyms (if =&gt; notation is not used) will 
 052        public bool? Expand { get; set; }
 53    }
 54}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SynonymTokenFilter.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    public partial class SynonymTokenFilter : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("synonyms");
 020            writer.WriteStartArray();
 021            foreach (var item in Synonyms)
 22            {
 023                writer.WriteStringValue(item);
 24            }
 025            writer.WriteEndArray();
 026            if (Optional.IsDefined(IgnoreCase))
 27            {
 028                writer.WritePropertyName("ignoreCase");
 029                writer.WriteBooleanValue(IgnoreCase.Value);
 30            }
 031            if (Optional.IsDefined(Expand))
 32            {
 033                writer.WritePropertyName("expand");
 034                writer.WriteBooleanValue(Expand.Value);
 35            }
 036            writer.WritePropertyName("@odata.type");
 037            writer.WriteStringValue(ODataType);
 038            writer.WritePropertyName("name");
 039            writer.WriteStringValue(Name);
 040            writer.WriteEndObject();
 041        }
 42
 43        internal static SynonymTokenFilter DeserializeSynonymTokenFilter(JsonElement element)
 44        {
 045            IList<string> synonyms = default;
 046            Optional<bool> ignoreCase = default;
 047            Optional<bool> expand = default;
 048            string odataType = default;
 049            string name = default;
 050            foreach (var property in element.EnumerateObject())
 51            {
 052                if (property.NameEquals("synonyms"))
 53                {
 054                    List<string> array = new List<string>();
 055                    foreach (var item in property.Value.EnumerateArray())
 56                    {
 057                        array.Add(item.GetString());
 58                    }
 059                    synonyms = array;
 060                    continue;
 61                }
 062                if (property.NameEquals("ignoreCase"))
 63                {
 064                    ignoreCase = property.Value.GetBoolean();
 065                    continue;
 66                }
 067                if (property.NameEquals("expand"))
 68                {
 069                    expand = property.Value.GetBoolean();
 070                    continue;
 71                }
 072                if (property.NameEquals("@odata.type"))
 73                {
 074                    odataType = property.Value.GetString();
 075                    continue;
 76                }
 077                if (property.NameEquals("name"))
 78                {
 079                    name = property.Value.GetString();
 80                    continue;
 81                }
 82            }
 083            return new SynonymTokenFilter(odataType, name, synonyms, Optional.ToNullable(ignoreCase), Optional.ToNullabl
 84        }
 85    }
 86}

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using Azure.Core;
 6
 7namespace Azure.Search.Documents.Indexes.Models
 8{
 9    public partial class SynonymTokenFilter
 10    {
 11        /// <summary> A list of synonyms in following one of two formats: 1. incredible, unbelievable, fabulous =&gt; am
 012        public IList<string> Synonyms { get; }
 13    }
 14}