< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_LowerCaseKeepWords()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeKeepTokenFilter(...)-0%0%
get_KeepWords()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\KeepTokenFilter.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> A token filter that only keeps tokens with text contained in a specified list of words. This token fil
 15    public partial class KeepTokenFilter : TokenFilter
 16    {
 17        /// <summary> Initializes a new instance of KeepTokenFilter. </summary>
 18        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 19        /// <param name="keepWords"> The list of words to keep. </param>
 20        /// <exception cref="ArgumentNullException"> <paramref name="name"/> or <paramref name="keepWords"/> is null. </
 021        public KeepTokenFilter(string name, IEnumerable<string> keepWords) : base(name)
 22        {
 023            if (name == null)
 24            {
 025                throw new ArgumentNullException(nameof(name));
 26            }
 027            if (keepWords == null)
 28            {
 029                throw new ArgumentNullException(nameof(keepWords));
 30            }
 31
 032            KeepWords = keepWords.ToList();
 033            ODataType = "#Microsoft.Azure.Search.KeepTokenFilter";
 034        }
 35
 36        /// <summary> Initializes a new instance of KeepTokenFilter. </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="keepWords"> The list of words to keep. </param>
 40        /// <param name="lowerCaseKeepWords"> A value indicating whether to lower case all words first. Default is false
 041        internal KeepTokenFilter(string oDataType, string name, IList<string> keepWords, bool? lowerCaseKeepWords) : bas
 42        {
 043            KeepWords = keepWords;
 044            LowerCaseKeepWords = lowerCaseKeepWords;
 045            ODataType = oDataType ?? "#Microsoft.Azure.Search.KeepTokenFilter";
 046        }
 47        /// <summary> A value indicating whether to lower case all words first. Default is false. </summary>
 048        public bool? LowerCaseKeepWords { get; set; }
 49    }
 50}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\KeepTokenFilter.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 KeepTokenFilter : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("keepWords");
 020            writer.WriteStartArray();
 021            foreach (var item in KeepWords)
 22            {
 023                writer.WriteStringValue(item);
 24            }
 025            writer.WriteEndArray();
 026            if (Optional.IsDefined(LowerCaseKeepWords))
 27            {
 028                writer.WritePropertyName("keepWordsCase");
 029                writer.WriteBooleanValue(LowerCaseKeepWords.Value);
 30            }
 031            writer.WritePropertyName("@odata.type");
 032            writer.WriteStringValue(ODataType);
 033            writer.WritePropertyName("name");
 034            writer.WriteStringValue(Name);
 035            writer.WriteEndObject();
 036        }
 37
 38        internal static KeepTokenFilter DeserializeKeepTokenFilter(JsonElement element)
 39        {
 040            IList<string> keepWords = default;
 041            Optional<bool> keepWordsCase = default;
 042            string odataType = default;
 043            string name = default;
 044            foreach (var property in element.EnumerateObject())
 45            {
 046                if (property.NameEquals("keepWords"))
 47                {
 048                    List<string> array = new List<string>();
 049                    foreach (var item in property.Value.EnumerateArray())
 50                    {
 051                        array.Add(item.GetString());
 52                    }
 053                    keepWords = array;
 054                    continue;
 55                }
 056                if (property.NameEquals("keepWordsCase"))
 57                {
 058                    keepWordsCase = property.Value.GetBoolean();
 059                    continue;
 60                }
 061                if (property.NameEquals("@odata.type"))
 62                {
 063                    odataType = property.Value.GetString();
 064                    continue;
 65                }
 066                if (property.NameEquals("name"))
 67                {
 068                    name = property.Value.GetString();
 69                    continue;
 70                }
 71            }
 072            return new KeepTokenFilter(odataType, name, keepWords, Optional.ToNullable(keepWordsCase));
 73        }
 74    }
 75}

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