< Summary

Class:Azure.Search.Documents.Indexes.Models.CommonGramTokenFilter
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\CommonGramTokenFilter.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\CommonGramTokenFilter.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\CommonGramTokenFilter.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_UseQueryMode()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeCommonGramTokenFilter(...)-0%0%
get_CommonWords()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\CommonGramTokenFilter.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> Construct bigrams for frequently occurring terms while indexing. Single terms are still indexed too, w
 15    public partial class CommonGramTokenFilter : TokenFilter
 16    {
 17        /// <summary> Initializes a new instance of CommonGramTokenFilter. </summary>
 18        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 19        /// <param name="commonWords"> The set of common words. </param>
 20        /// <exception cref="ArgumentNullException"> <paramref name="name"/> or <paramref name="commonWords"/> is null. 
 021        public CommonGramTokenFilter(string name, IEnumerable<string> commonWords) : base(name)
 22        {
 023            if (name == null)
 24            {
 025                throw new ArgumentNullException(nameof(name));
 26            }
 027            if (commonWords == null)
 28            {
 029                throw new ArgumentNullException(nameof(commonWords));
 30            }
 31
 032            CommonWords = commonWords.ToList();
 033            ODataType = "#Microsoft.Azure.Search.CommonGramTokenFilter";
 034        }
 35
 36        /// <summary> Initializes a new instance of CommonGramTokenFilter. </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="commonWords"> The set of common words. </param>
 40        /// <param name="ignoreCase"> A value indicating whether common words matching will be case insensitive. Default
 41        /// <param name="useQueryMode"> A value that indicates whether the token filter is in query mode. When in query 
 042        internal CommonGramTokenFilter(string oDataType, string name, IList<string> commonWords, bool? ignoreCase, bool?
 43        {
 044            CommonWords = commonWords;
 045            IgnoreCase = ignoreCase;
 046            UseQueryMode = useQueryMode;
 047            ODataType = oDataType ?? "#Microsoft.Azure.Search.CommonGramTokenFilter";
 048        }
 49        /// <summary> A value indicating whether common words matching will be case insensitive. Default is false. </sum
 050        public bool? IgnoreCase { get; set; }
 51        /// <summary> A value that indicates whether the token filter is in query mode. When in query mode, the token fi
 052        public bool? UseQueryMode { get; set; }
 53    }
 54}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\CommonGramTokenFilter.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 CommonGramTokenFilter : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("commonWords");
 020            writer.WriteStartArray();
 021            foreach (var item in CommonWords)
 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(UseQueryMode))
 32            {
 033                writer.WritePropertyName("queryMode");
 034                writer.WriteBooleanValue(UseQueryMode.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 CommonGramTokenFilter DeserializeCommonGramTokenFilter(JsonElement element)
 44        {
 045            IList<string> commonWords = default;
 046            Optional<bool> ignoreCase = default;
 047            Optional<bool> queryMode = default;
 048            string odataType = default;
 049            string name = default;
 050            foreach (var property in element.EnumerateObject())
 51            {
 052                if (property.NameEquals("commonWords"))
 53                {
 054                    List<string> array = new List<string>();
 055                    foreach (var item in property.Value.EnumerateArray())
 56                    {
 057                        array.Add(item.GetString());
 58                    }
 059                    commonWords = array;
 060                    continue;
 61                }
 062                if (property.NameEquals("ignoreCase"))
 63                {
 064                    ignoreCase = property.Value.GetBoolean();
 065                    continue;
 66                }
 067                if (property.NameEquals("queryMode"))
 68                {
 069                    queryMode = 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 CommonGramTokenFilter(odataType, name, commonWords, Optional.ToNullable(ignoreCase), Optional.ToN
 84        }
 85    }
 86}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\CommonGramTokenFilter.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 CommonGramTokenFilter
 10    {
 11        /// <summary> The set of common words. </summary>
 012        public IList<string> CommonWords { get; }
 13    }
 14}