< Summary

Class:Microsoft.Azure.Search.Models.KeepTokenFilter
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\KeepTokenFilter.cs
Covered lines:11
Uncovered lines:1
Coverable lines:12
Total lines:89
Line coverage:91.6% (11 of 12)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_KeepWords()-100%100%
get_LowerCaseKeepWords()-100%100%
Validate()-75%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\KeepTokenFilter.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.Search.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// A token filter that only keeps tokens with text contained in a
 21    /// specified list of words. This token filter is implemented using Apache
 22    /// Lucene.
 23    /// <see
 24    /// href="http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/KeepWordFil
 25    /// />
 26    /// </summary>
 27    [Newtonsoft.Json.JsonObject("#Microsoft.Azure.Search.KeepTokenFilter")]
 28    public partial class KeepTokenFilter : TokenFilter
 29    {
 30        /// <summary>
 31        /// Initializes a new instance of the KeepTokenFilter class.
 32        /// </summary>
 433        public KeepTokenFilter()
 34        {
 35            CustomInit();
 436        }
 37
 38        /// <summary>
 39        /// Initializes a new instance of the KeepTokenFilter class.
 40        /// </summary>
 41        /// <param name="name">The name of the token filter. It must only
 42        /// contain letters, digits, spaces, dashes or underscores, can only
 43        /// start and end with alphanumeric characters, and is limited to 128
 44        /// characters.</param>
 45        /// <param name="keepWords">The list of words to keep.</param>
 46        /// <param name="lowerCaseKeepWords">A value indicating whether to
 47        /// lower case all words first. Default is false.</param>
 48        public KeepTokenFilter(string name, IList<string> keepWords, bool? lowerCaseKeepWords = default(bool?))
 449            : base(name)
 50        {
 451            KeepWords = keepWords;
 452            LowerCaseKeepWords = lowerCaseKeepWords;
 53            CustomInit();
 454        }
 55
 56        /// <summary>
 57        /// An initialization method that performs custom operations like setting defaults
 58        /// </summary>
 59        partial void CustomInit();
 60
 61        /// <summary>
 62        /// Gets or sets the list of words to keep.
 63        /// </summary>
 64        [JsonProperty(PropertyName = "keepWords")]
 2465        public IList<string> KeepWords { get; set; }
 66
 67        /// <summary>
 68        /// Gets or sets a value indicating whether to lower case all words
 69        /// first. Default is false.
 70        /// </summary>
 71        [JsonProperty(PropertyName = "keepWordsCase")]
 2072        public bool? LowerCaseKeepWords { get; set; }
 73
 74        /// <summary>
 75        /// Validate the object.
 76        /// </summary>
 77        /// <exception cref="ValidationException">
 78        /// Thrown if validation fails
 79        /// </exception>
 80        public override void Validate()
 81        {
 482            base.Validate();
 483            if (KeepWords == null)
 84            {
 085                throw new ValidationException(ValidationRules.CannotBeNull, "KeepWords");
 86            }
 487        }
 88    }
 89}