< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_MaxShingleSize()-0%100%
get_MinShingleSize()-0%100%
get_OutputUnigrams()-0%100%
get_OutputUnigramsIfNoShingles()-0%100%
get_TokenSeparator()-0%100%
get_FilterToken()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeShingleTokenFilter(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\ShingleTokenFilter.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> Creates combinations of tokens as a single token. This token filter is implemented using Apache Lucene
 13    public partial class ShingleTokenFilter : TokenFilter
 14    {
 15        /// <summary> Initializes a new instance of ShingleTokenFilter. </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 ShingleTokenFilter(string name) : base(name)
 19        {
 020            if (name == null)
 21            {
 022                throw new ArgumentNullException(nameof(name));
 23            }
 24
 025            ODataType = "#Microsoft.Azure.Search.ShingleTokenFilter";
 026        }
 27
 28        /// <summary> Initializes a new instance of ShingleTokenFilter. </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="maxShingleSize"> The maximum shingle size. Default and minimum value is 2. </param>
 32        /// <param name="minShingleSize"> The minimum shingle size. Default and minimum value is 2. Must be less than th
 33        /// <param name="outputUnigrams"> A value indicating whether the output stream will contain the input tokens (un
 34        /// <param name="outputUnigramsIfNoShingles"> A value indicating whether to output unigrams for those times when
 35        /// <param name="tokenSeparator"> The string to use when joining adjacent tokens to form a shingle. Default is a
 36        /// <param name="filterToken"> The string to insert for each position at which there is no token. Default is an 
 037        internal ShingleTokenFilter(string oDataType, string name, int? maxShingleSize, int? minShingleSize, bool? outpu
 38        {
 039            MaxShingleSize = maxShingleSize;
 040            MinShingleSize = minShingleSize;
 041            OutputUnigrams = outputUnigrams;
 042            OutputUnigramsIfNoShingles = outputUnigramsIfNoShingles;
 043            TokenSeparator = tokenSeparator;
 044            FilterToken = filterToken;
 045            ODataType = oDataType ?? "#Microsoft.Azure.Search.ShingleTokenFilter";
 046        }
 47
 48        /// <summary> The maximum shingle size. Default and minimum value is 2. </summary>
 049        public int? MaxShingleSize { get; set; }
 50        /// <summary> The minimum shingle size. Default and minimum value is 2. Must be less than the value of maxShingl
 051        public int? MinShingleSize { get; set; }
 52        /// <summary> A value indicating whether the output stream will contain the input tokens (unigrams) as well as s
 053        public bool? OutputUnigrams { get; set; }
 54        /// <summary> A value indicating whether to output unigrams for those times when no shingles are available. This
 055        public bool? OutputUnigramsIfNoShingles { get; set; }
 56        /// <summary> The string to use when joining adjacent tokens to form a shingle. Default is a single space (&quot
 057        public string TokenSeparator { get; set; }
 58        /// <summary> The string to insert for each position at which there is no token. Default is an underscore (&quot
 059        public string FilterToken { get; set; }
 60    }
 61}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\ShingleTokenFilter.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 ShingleTokenFilter : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (Optional.IsDefined(MaxShingleSize))
 19            {
 020                writer.WritePropertyName("maxShingleSize");
 021                writer.WriteNumberValue(MaxShingleSize.Value);
 22            }
 023            if (Optional.IsDefined(MinShingleSize))
 24            {
 025                writer.WritePropertyName("minShingleSize");
 026                writer.WriteNumberValue(MinShingleSize.Value);
 27            }
 028            if (Optional.IsDefined(OutputUnigrams))
 29            {
 030                writer.WritePropertyName("outputUnigrams");
 031                writer.WriteBooleanValue(OutputUnigrams.Value);
 32            }
 033            if (Optional.IsDefined(OutputUnigramsIfNoShingles))
 34            {
 035                writer.WritePropertyName("outputUnigramsIfNoShingles");
 036                writer.WriteBooleanValue(OutputUnigramsIfNoShingles.Value);
 37            }
 038            if (Optional.IsDefined(TokenSeparator))
 39            {
 040                writer.WritePropertyName("tokenSeparator");
 041                writer.WriteStringValue(TokenSeparator);
 42            }
 043            if (Optional.IsDefined(FilterToken))
 44            {
 045                writer.WritePropertyName("filterToken");
 046                writer.WriteStringValue(FilterToken);
 47            }
 048            writer.WritePropertyName("@odata.type");
 049            writer.WriteStringValue(ODataType);
 050            writer.WritePropertyName("name");
 051            writer.WriteStringValue(Name);
 052            writer.WriteEndObject();
 053        }
 54
 55        internal static ShingleTokenFilter DeserializeShingleTokenFilter(JsonElement element)
 56        {
 057            Optional<int> maxShingleSize = default;
 058            Optional<int> minShingleSize = default;
 059            Optional<bool> outputUnigrams = default;
 060            Optional<bool> outputUnigramsIfNoShingles = default;
 061            Optional<string> tokenSeparator = default;
 062            Optional<string> filterToken = default;
 063            string odataType = default;
 064            string name = default;
 065            foreach (var property in element.EnumerateObject())
 66            {
 067                if (property.NameEquals("maxShingleSize"))
 68                {
 069                    maxShingleSize = property.Value.GetInt32();
 070                    continue;
 71                }
 072                if (property.NameEquals("minShingleSize"))
 73                {
 074                    minShingleSize = property.Value.GetInt32();
 075                    continue;
 76                }
 077                if (property.NameEquals("outputUnigrams"))
 78                {
 079                    outputUnigrams = property.Value.GetBoolean();
 080                    continue;
 81                }
 082                if (property.NameEquals("outputUnigramsIfNoShingles"))
 83                {
 084                    outputUnigramsIfNoShingles = property.Value.GetBoolean();
 085                    continue;
 86                }
 087                if (property.NameEquals("tokenSeparator"))
 88                {
 089                    tokenSeparator = property.Value.GetString();
 090                    continue;
 91                }
 092                if (property.NameEquals("filterToken"))
 93                {
 094                    filterToken = property.Value.GetString();
 095                    continue;
 96                }
 097                if (property.NameEquals("@odata.type"))
 98                {
 099                    odataType = property.Value.GetString();
 0100                    continue;
 101                }
 0102                if (property.NameEquals("name"))
 103                {
 0104                    name = property.Value.GetString();
 105                    continue;
 106                }
 107            }
 0108            return new ShingleTokenFilter(odataType, name, Optional.ToNullable(maxShingleSize), Optional.ToNullable(minS
 109        }
 110    }
 111}