< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_StopwordsList()-0%100%
get_IgnoreCase()-0%100%
get_RemoveTrailingStopWords()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeStopwordsTokenFilter(...)-0%0%
get_Stopwords()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\StopwordsTokenFilter.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 Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    /// <summary> Removes stop words from a token stream. This token filter is implemented using Apache Lucene. </summar
 15    public partial class StopwordsTokenFilter : TokenFilter
 16    {
 17        /// <summary> Initializes a new instance of StopwordsTokenFilter. </summary>
 18        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 19        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
 020        public StopwordsTokenFilter(string name) : base(name)
 21        {
 022            if (name == null)
 23            {
 024                throw new ArgumentNullException(nameof(name));
 25            }
 26
 027            Stopwords = new ChangeTrackingList<string>();
 028            ODataType = "#Microsoft.Azure.Search.StopwordsTokenFilter";
 029        }
 30
 31        /// <summary> Initializes a new instance of StopwordsTokenFilter. </summary>
 32        /// <param name="oDataType"> Identifies the concrete type of the token filter. </param>
 33        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 34        /// <param name="stopwords"> The list of stopwords. This property and the stopwords list property cannot both be
 35        /// <param name="stopwordsList"> A predefined list of stopwords to use. This property and the stopwords property
 36        /// <param name="ignoreCase"> A value indicating whether to ignore case. If true, all words are converted to low
 37        /// <param name="removeTrailingStopWords"> A value indicating whether to ignore the last search term if it&apos;
 038        internal StopwordsTokenFilter(string oDataType, string name, IList<string> stopwords, StopwordsList? stopwordsLi
 39        {
 040            Stopwords = stopwords;
 041            StopwordsList = stopwordsList;
 042            IgnoreCase = ignoreCase;
 043            RemoveTrailingStopWords = removeTrailingStopWords;
 044            ODataType = oDataType ?? "#Microsoft.Azure.Search.StopwordsTokenFilter";
 045        }
 46        /// <summary> A predefined list of stopwords to use. This property and the stopwords property cannot both be set
 047        public StopwordsList? StopwordsList { get; set; }
 48        /// <summary> A value indicating whether to ignore case. If true, all words are converted to lower case first. D
 049        public bool? IgnoreCase { get; set; }
 50        /// <summary> A value indicating whether to ignore the last search term if it&apos;s a stop word. Default is tru
 051        public bool? RemoveTrailingStopWords { get; set; }
 52    }
 53}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\StopwordsTokenFilter.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 StopwordsTokenFilter : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Optional.IsCollectionDefined(Stopwords))
 20            {
 021                writer.WritePropertyName("stopwords");
 022                writer.WriteStartArray();
 023                foreach (var item in Stopwords)
 24                {
 025                    writer.WriteStringValue(item);
 26                }
 027                writer.WriteEndArray();
 28            }
 029            if (Optional.IsDefined(StopwordsList))
 30            {
 031                writer.WritePropertyName("stopwordsList");
 032                writer.WriteStringValue(StopwordsList.Value.ToSerialString());
 33            }
 034            if (Optional.IsDefined(IgnoreCase))
 35            {
 036                writer.WritePropertyName("ignoreCase");
 037                writer.WriteBooleanValue(IgnoreCase.Value);
 38            }
 039            if (Optional.IsDefined(RemoveTrailingStopWords))
 40            {
 041                writer.WritePropertyName("removeTrailing");
 042                writer.WriteBooleanValue(RemoveTrailingStopWords.Value);
 43            }
 044            writer.WritePropertyName("@odata.type");
 045            writer.WriteStringValue(ODataType);
 046            writer.WritePropertyName("name");
 047            writer.WriteStringValue(Name);
 048            writer.WriteEndObject();
 049        }
 50
 51        internal static StopwordsTokenFilter DeserializeStopwordsTokenFilter(JsonElement element)
 52        {
 053            Optional<IList<string>> stopwords = default;
 054            Optional<StopwordsList> stopwordsList = default;
 055            Optional<bool> ignoreCase = default;
 056            Optional<bool> removeTrailing = default;
 057            string odataType = default;
 058            string name = default;
 059            foreach (var property in element.EnumerateObject())
 60            {
 061                if (property.NameEquals("stopwords"))
 62                {
 063                    List<string> array = new List<string>();
 064                    foreach (var item in property.Value.EnumerateArray())
 65                    {
 066                        array.Add(item.GetString());
 67                    }
 068                    stopwords = array;
 069                    continue;
 70                }
 071                if (property.NameEquals("stopwordsList"))
 72                {
 073                    stopwordsList = property.Value.GetString().ToStopwordsList();
 074                    continue;
 75                }
 076                if (property.NameEquals("ignoreCase"))
 77                {
 078                    ignoreCase = property.Value.GetBoolean();
 079                    continue;
 80                }
 081                if (property.NameEquals("removeTrailing"))
 82                {
 083                    removeTrailing = property.Value.GetBoolean();
 084                    continue;
 85                }
 086                if (property.NameEquals("@odata.type"))
 87                {
 088                    odataType = property.Value.GetString();
 089                    continue;
 90                }
 091                if (property.NameEquals("name"))
 92                {
 093                    name = property.Value.GetString();
 94                    continue;
 95                }
 96            }
 097            return new StopwordsTokenFilter(odataType, name, Optional.ToList(stopwords), Optional.ToNullable(stopwordsLi
 98        }
 99    }
 100}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\StopwordsTokenFilter.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 StopwordsTokenFilter
 10    {
 11        /// <summary> The list of stopwords. This property and the stopwords list property cannot both be set. </summary
 012        public IList<string> Stopwords { get; }
 13    }
 14}