< Summary

Class:Azure.Search.Documents.Indexes.Models.PathHierarchyTokenizer
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PathHierarchyTokenizer.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PathHierarchyTokenizer.Serialization.cs
Covered lines:68
Uncovered lines:1
Coverable lines:69
Total lines:157
Line coverage:98.5% (68 of 69)
Covered branches:28
Total branches:30
Branch coverage:93.3% (28 of 30)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%50%
get_Delimiter()-100%100%
get_Replacement()-100%100%
get_MaxTokenLength()-100%100%
get_ReverseTokenOrder()-100%100%
get_NumberOfTokensToSkip()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializePathHierarchyTokenizer(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PathHierarchyTokenizer.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> Tokenizer for path-like hierarchies. This tokenizer is implemented using Apache Lucene. </summary>
 13    public partial class PathHierarchyTokenizer : LexicalTokenizer
 14    {
 15        /// <summary> Initializes a new instance of PathHierarchyTokenizer. </summary>
 16        /// <param name="name"> The name of the tokenizer. It must only contain letters, digits, spaces, dashes or under
 17        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
 118        public PathHierarchyTokenizer(string name) : base(name)
 19        {
 120            if (name == null)
 21            {
 022                throw new ArgumentNullException(nameof(name));
 23            }
 24
 125            ODataType = "#Microsoft.Azure.Search.PathHierarchyTokenizerV2";
 126        }
 27
 28        /// <summary> Initializes a new instance of PathHierarchyTokenizer. </summary>
 29        /// <param name="oDataType"> Identifies the concrete type of the tokenizer. </param>
 30        /// <param name="name"> The name of the tokenizer. It must only contain letters, digits, spaces, dashes or under
 31        /// <param name="delimiter"> The delimiter character to use. Default is &quot;/&quot;. </param>
 32        /// <param name="replacement"> A value that, if set, replaces the delimiter character. Default is &quot;/&quot;.
 33        /// <param name="maxTokenLength"> The maximum token length. Default and maximum is 300. </param>
 34        /// <param name="reverseTokenOrder"> A value indicating whether to generate tokens in reverse order. Default is 
 35        /// <param name="numberOfTokensToSkip"> The number of initial tokens to skip. Default is 0. </param>
 136        internal PathHierarchyTokenizer(string oDataType, string name, char? delimiter, char? replacement, int? maxToken
 37        {
 138            Delimiter = delimiter;
 139            Replacement = replacement;
 140            MaxTokenLength = maxTokenLength;
 141            ReverseTokenOrder = reverseTokenOrder;
 142            NumberOfTokensToSkip = numberOfTokensToSkip;
 143            ODataType = oDataType ?? "#Microsoft.Azure.Search.PathHierarchyTokenizerV2";
 144        }
 45
 46        /// <summary> The delimiter character to use. Default is &quot;/&quot;. </summary>
 447        public char? Delimiter { get; set; }
 48        /// <summary> A value that, if set, replaces the delimiter character. Default is &quot;/&quot;. </summary>
 449        public char? Replacement { get; set; }
 50        /// <summary> The maximum token length. Default and maximum is 300. </summary>
 451        public int? MaxTokenLength { get; set; }
 52        /// <summary> A value indicating whether to generate tokens in reverse order. Default is false. </summary>
 453        public bool? ReverseTokenOrder { get; set; }
 54        /// <summary> The number of initial tokens to skip. Default is 0. </summary>
 455        public int? NumberOfTokensToSkip { get; set; }
 56    }
 57}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PathHierarchyTokenizer.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 PathHierarchyTokenizer : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 117            writer.WriteStartObject();
 118            if (Optional.IsDefined(Delimiter))
 19            {
 120                writer.WritePropertyName("delimiter");
 121                writer.WriteStringValue(Delimiter.Value);
 22            }
 123            if (Optional.IsDefined(Replacement))
 24            {
 125                writer.WritePropertyName("replacement");
 126                writer.WriteStringValue(Replacement.Value);
 27            }
 128            if (Optional.IsDefined(MaxTokenLength))
 29            {
 130                writer.WritePropertyName("maxTokenLength");
 131                writer.WriteNumberValue(MaxTokenLength.Value);
 32            }
 133            if (Optional.IsDefined(ReverseTokenOrder))
 34            {
 135                writer.WritePropertyName("reverse");
 136                writer.WriteBooleanValue(ReverseTokenOrder.Value);
 37            }
 138            if (Optional.IsDefined(NumberOfTokensToSkip))
 39            {
 140                writer.WritePropertyName("skip");
 141                writer.WriteNumberValue(NumberOfTokensToSkip.Value);
 42            }
 143            writer.WritePropertyName("@odata.type");
 144            writer.WriteStringValue(ODataType);
 145            writer.WritePropertyName("name");
 146            writer.WriteStringValue(Name);
 147            writer.WriteEndObject();
 148        }
 49
 50        internal static PathHierarchyTokenizer DeserializePathHierarchyTokenizer(JsonElement element)
 51        {
 152            Optional<char> delimiter = default;
 153            Optional<char> replacement = default;
 154            Optional<int> maxTokenLength = default;
 155            Optional<bool> reverse = default;
 156            Optional<int> skip = default;
 157            string odataType = default;
 158            string name = default;
 1659            foreach (var property in element.EnumerateObject())
 60            {
 761                if (property.NameEquals("delimiter"))
 62                {
 163                    delimiter = property.Value.GetChar();
 164                    continue;
 65                }
 666                if (property.NameEquals("replacement"))
 67                {
 168                    replacement = property.Value.GetChar();
 169                    continue;
 70                }
 571                if (property.NameEquals("maxTokenLength"))
 72                {
 173                    maxTokenLength = property.Value.GetInt32();
 174                    continue;
 75                }
 476                if (property.NameEquals("reverse"))
 77                {
 178                    reverse = property.Value.GetBoolean();
 179                    continue;
 80                }
 381                if (property.NameEquals("skip"))
 82                {
 183                    skip = property.Value.GetInt32();
 184                    continue;
 85                }
 286                if (property.NameEquals("@odata.type"))
 87                {
 188                    odataType = property.Value.GetString();
 189                    continue;
 90                }
 191                if (property.NameEquals("name"))
 92                {
 193                    name = property.Value.GetString();
 94                    continue;
 95                }
 96            }
 197            return new PathHierarchyTokenizer(odataType, name, Optional.ToNullable(delimiter), Optional.ToNullable(repla
 98        }
 99    }
 100}