< Summary

Class:Azure.Search.Documents.AutocompleteOptions
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\AutocompleteOptions.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\AutocompleteOptions.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Options\AutocompleteOptions.cs
Covered lines:55
Uncovered lines:3
Coverable lines:58
Total lines:194
Line coverage:94.8% (55 of 58)
Covered branches:15
Total branches:16
Branch coverage:93.7% (15 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_UseFuzzyMatching()-100%100%
get_HighlightPostTag()-100%100%
get_HighlightPreTag()-100%100%
get_MinimumCoverage()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-93.55%93.75%
.ctor()-100%100%
get_SearchText()-100%100%
get_SuggesterName()-100%100%
get_Mode()-100%100%
get_Filter()-100%100%
get_Size()-100%100%
get_SearchFields()-100%100%
get_SearchFieldsRaw()-100%100%
set_SearchFieldsRaw(...)-0%100%
Clone()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\AutocompleteOptions.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 Azure.Search.Documents.Models;
 10
 11namespace Azure.Search.Documents
 12{
 13    /// <summary> Parameters for fuzzy matching, and other autocomplete query behaviors. </summary>
 14    public partial class AutocompleteOptions
 15    {
 16        /// <summary> A value indicating whether to use fuzzy matching for the autocomplete query. Default is false. Whe
 12017        public bool? UseFuzzyMatching { get; set; }
 18        /// <summary> A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit
 10419        public string HighlightPostTag { get; set; }
 20        /// <summary> A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, h
 10421        public string HighlightPreTag { get; set; }
 22        /// <summary> A number between 0 and 100 indicating the percentage of the index that must be covered by an autoc
 10023        public double? MinimumCoverage { get; set; }
 24    }
 25}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\AutocompleteOptions.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;
 10using Azure.Search.Documents.Models;
 11
 12namespace Azure.Search.Documents
 13{
 14    public partial class AutocompleteOptions : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 3618            writer.WriteStartObject();
 3619            writer.WritePropertyName("search");
 3620            writer.WriteStringValue(SearchText);
 3621            if (Optional.IsDefined(Mode))
 22            {
 3223                writer.WritePropertyName("autocompleteMode");
 3224                writer.WriteStringValue(Mode.Value.ToSerialString());
 25            }
 3626            if (Optional.IsDefined(Filter))
 27            {
 828                writer.WritePropertyName("filter");
 829                writer.WriteStringValue(Filter);
 30            }
 3631            if (Optional.IsDefined(UseFuzzyMatching))
 32            {
 1033                writer.WritePropertyName("fuzzy");
 1034                writer.WriteBooleanValue(UseFuzzyMatching.Value);
 35            }
 3636            if (Optional.IsDefined(HighlightPostTag))
 37            {
 238                writer.WritePropertyName("highlightPostTag");
 239                writer.WriteStringValue(HighlightPostTag);
 40            }
 3641            if (Optional.IsDefined(HighlightPreTag))
 42            {
 243                writer.WritePropertyName("highlightPreTag");
 244                writer.WriteStringValue(HighlightPreTag);
 45            }
 3646            if (Optional.IsDefined(MinimumCoverage))
 47            {
 048                writer.WritePropertyName("minimumCoverage");
 049                writer.WriteNumberValue(MinimumCoverage.Value);
 50            }
 3651            if (Optional.IsDefined(SearchFieldsRaw))
 52            {
 653                writer.WritePropertyName("searchFields");
 654                writer.WriteStringValue(SearchFieldsRaw);
 55            }
 3656            writer.WritePropertyName("suggesterName");
 3657            writer.WriteStringValue(SuggesterName);
 3658            if (Optional.IsDefined(Size))
 59            {
 260                writer.WritePropertyName("top");
 261                writer.WriteNumberValue(Size.Value);
 62            }
 3663            writer.WriteEndObject();
 3664        }
 65    }
 66}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Options\AutocompleteOptions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using Azure.Core;
 7using Azure.Search.Documents.Models;
 8
 9namespace Azure.Search.Documents
 10{
 11    /// <summary>
 12    /// Options for <see cref="SearchClient.AutocompleteAsync"/> that
 13    /// allow specifying autocomplete behaviors, like fuzzy matching.
 14    /// </summary>
 15    [CodeGenModel("AutocompleteRequest")]
 16    [CodeGenSuppress(nameof(AutocompleteOptions), typeof(string), typeof(string))]
 17    public partial class AutocompleteOptions
 18    {
 19        /// <summary>
 20        /// Initializes new instance of <see cref="AutocompleteOptions"/>
 21        /// </summary>
 6822        public AutocompleteOptions()
 23        {
 6824        }
 25
 26        /// <summary>
 27        /// The search text on which to base autocomplete results.
 28        /// </summary>
 29        [CodeGenMember("search")]
 13630        internal string SearchText { get; set; }
 31
 32        /// <summary>
 33        /// The name of the suggester as specified in the suggesters collection
 34        /// that's part of the index definition.
 35        /// </summary>
 36        [CodeGenMember("suggesterName")]
 13637        internal string SuggesterName { get; set; }
 38
 39        /// <summary>
 40        /// Specifies the mode for Autocomplete. The default is
 41        /// <see cref="AutocompleteMode.OneTerm"/>. Use
 42        /// <see cref="AutocompleteMode.TwoTerms"/> to get shingles and
 43        /// <see cref="AutocompleteMode.OneTermWithContext"/> to use the
 44        /// current context while producing auto-completed terms.
 45        /// </summary>
 46        [CodeGenMember("autocompleteMode")]
 16447        public AutocompleteMode? Mode { get; set; }
 48
 49        /// <summary>
 50        /// An OData expression that filters the documents used to produce
 51        /// completed terms for the Autocomplete result.  You can use
 52        /// <see cref="SearchFilter.Create(FormattableString)"/> to help
 53        /// construct the filter expression.
 54        /// </summary>
 55        [CodeGenMember("filter")]
 11656        public string Filter { get; set; }
 57
 58        /// <summary>
 59        /// The number of auto-completed terms to retrieve. This must be a
 60        /// value between 1 and 100. The default is 5.
 61        /// </summary>
 62        [CodeGenMember("top")]
 10463        public int? Size { get; set; }
 64
 65        /// <summary>
 66        /// The list of field names to consider when querying for
 67        /// auto-completed terms. Target fields must be included in the
 68        /// specified suggester.
 69        /// </summary>
 18070        public IList<string> SearchFields { get; internal set; } = new List<string>();
 71
 72        #pragma warning disable CA1822 // Only (unused but required) setters are static
 73        /// <summary>
 74        /// Join SearchFields so it can be sent as a comma separated string.
 75        /// </summary>
 76        [CodeGenMember("searchFields")]
 77        internal string SearchFieldsRaw
 78        {
 4279            get => SearchFields.CommaJoin();
 080            set => throw new InvalidOperationException($"Cannot deserialize {nameof(AutocompleteOptions)}.");
 81        }
 82        #pragma warning restore CA1822
 83
 84        /// <summary>
 85        /// Creates a shallow copy of the AutocompleteOptions.
 86        /// </summary>
 87        /// <returns>The cloned AutocompleteOptions.</returns>
 88        internal AutocompleteOptions Clone() =>
 3289            new AutocompleteOptions
 3290            {
 3291                SearchText = SearchText,
 3292                SuggesterName = SuggesterName,
 3293                Mode = Mode,
 3294                Filter = Filter,
 3295                Size = Size,
 3296                SearchFields = SearchFields,
 3297                HighlightPostTag = HighlightPostTag,
 3298                HighlightPreTag = HighlightPreTag,
 3299                MinimumCoverage = MinimumCoverage,
 32100                UseFuzzyMatching = UseFuzzyMatching,
 32101            };
 102    }
 103}