< Summary

Class:Azure.Search.Documents.SuggestOptions
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SuggestOptions.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SuggestOptions.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Options\SuggestOptions.cs
Covered lines:64
Uncovered lines:3
Coverable lines:67
Total lines:230
Line coverage:95.5% (64 of 67)
Covered branches:18
Total branches:18
Branch coverage:100% (18 of 18)

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(...)-100%100%
.ctor()-100%100%
get_SearchText()-100%100%
get_SuggesterName()-100%100%
get_Filter()-100%100%
get_SearchFields()-100%100%
get_SearchFieldsRaw()-100%100%
set_SearchFieldsRaw(...)-0%100%
get_Select()-100%100%
get_SelectRaw()-100%100%
set_SelectRaw(...)-0%100%
get_Size()-100%100%
get_OrderBy()-100%100%
get_OrderByRaw()-100%100%
set_OrderByRaw(...)-0%100%
Clone()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SuggestOptions.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
 11{
 12    /// <summary> Parameters for filtering, sorting, fuzzy matching, and other suggestions query behaviors. </summary>
 13    public partial class SuggestOptions
 14    {
 15        /// <summary> A value indicating whether to use fuzzy matching for the suggestion query. Default is false. When 
 7416        public bool? UseFuzzyMatching { get; set; }
 17        /// <summary> A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, hit
 7418        public string HighlightPostTag { get; set; }
 19        /// <summary> A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If omitted, h
 7420        public string HighlightPreTag { get; set; }
 21        /// <summary> A number between 0 and 100 indicating the percentage of the index that must be covered by a sugges
 7422        public double? MinimumCoverage { get; set; }
 23    }
 24}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SuggestOptions.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
 12{
 13    public partial class SuggestOptions : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 2617            writer.WriteStartObject();
 2618            if (Optional.IsDefined(Filter))
 19            {
 420                writer.WritePropertyName("filter");
 421                writer.WriteStringValue(Filter);
 22            }
 2623            if (Optional.IsDefined(UseFuzzyMatching))
 24            {
 225                writer.WritePropertyName("fuzzy");
 226                writer.WriteBooleanValue(UseFuzzyMatching.Value);
 27            }
 2628            if (Optional.IsDefined(HighlightPostTag))
 29            {
 230                writer.WritePropertyName("highlightPostTag");
 231                writer.WriteStringValue(HighlightPostTag);
 32            }
 2633            if (Optional.IsDefined(HighlightPreTag))
 34            {
 235                writer.WritePropertyName("highlightPreTag");
 236                writer.WriteStringValue(HighlightPreTag);
 37            }
 2638            if (Optional.IsDefined(MinimumCoverage))
 39            {
 240                writer.WritePropertyName("minimumCoverage");
 241                writer.WriteNumberValue(MinimumCoverage.Value);
 42            }
 2643            if (Optional.IsDefined(OrderByRaw))
 44            {
 1245                writer.WritePropertyName("orderby");
 1246                writer.WriteStringValue(OrderByRaw);
 47            }
 2648            writer.WritePropertyName("search");
 2649            writer.WriteStringValue(SearchText);
 2650            if (Optional.IsDefined(SearchFieldsRaw))
 51            {
 252                writer.WritePropertyName("searchFields");
 253                writer.WriteStringValue(SearchFieldsRaw);
 54            }
 2655            if (Optional.IsDefined(SelectRaw))
 56            {
 257                writer.WritePropertyName("select");
 258                writer.WriteStringValue(SelectRaw);
 59            }
 2660            writer.WritePropertyName("suggesterName");
 2661            writer.WriteStringValue(SuggesterName);
 2662            if (Optional.IsDefined(Size))
 63            {
 464                writer.WritePropertyName("top");
 465                writer.WriteNumberValue(Size.Value);
 66            }
 2667            writer.WriteEndObject();
 2668        }
 69    }
 70}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Options\SuggestOptions.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;
 7
 8namespace Azure.Search.Documents
 9{
 10    /// <summary>
 11    /// Options for <see cref="SearchClient.SuggestAsync"/> that
 12    /// allow specifying filtering, sorting, and other suggestions query
 13    /// behaviors.
 14    /// </summary>
 15    [CodeGenModel("SuggestRequest")]
 16    [CodeGenSuppress(nameof(SuggestOptions), typeof(string), typeof(string))]
 17    public partial class SuggestOptions
 18    {
 19        /// <summary>
 20        /// Initializes new instance of <see cref="SuggestOptions"/>
 21        /// </summary>
 4822        public SuggestOptions()
 23        {
 4824        }
 25
 26        /// <summary>
 27        /// The search text to use to suggest documents. Must be at least 1
 28        /// character, and no more than 100 characters.
 29        /// </summary>
 30        [CodeGenMember("search")]
 9631        internal string SearchText { get; set; }
 32
 33        /// <summary>
 34        /// The name of the suggester as specified in the suggesters collection
 35        /// that's part of the index definition.
 36        /// </summary>
 37        [CodeGenMember("suggesterName")]
 9638        internal string SuggesterName { get; set; }
 39
 40        /// <summary>
 41        /// An OData expression that filters the documents considered for
 42        /// suggestions.  You can use
 43        /// <see cref="SearchFilter.Create(FormattableString)"/> to help
 44        /// construct the filter expression.
 45        /// </summary>
 46        [CodeGenMember("filter")]
 7847        public string Filter { get; set; }
 48
 49        /// <summary>
 50        /// The list of field names to search for the specified search text.
 51        /// Target fields must be included in the specified suggester.
 52        /// </summary>
 12253        public IList<string> SearchFields { get; internal set; } = new List<string>();
 54
 55        #pragma warning disable CA1822 // Only (unused but required) setters are static
 56        /// <summary>
 57        /// Join SearchFields so it can be sent as a comma separated string.
 58        /// </summary>
 59        [CodeGenMember("searchFields")]
 60        internal string SearchFieldsRaw
 61        {
 2862            get => SearchFields.CommaJoin();
 063            set => throw new InvalidOperationException($"Cannot deserialize {nameof(SuggestOptions)}.");
 64        }
 65        #pragma warning restore CA1822
 66
 67        /// <summary>
 68        /// The list of fields to retrieve. If unspecified, only the key field
 69        /// will be included in the results.
 70        /// </summary>
 12271        public IList<string> Select { get; internal set; } = new List<string>();
 72
 73        #pragma warning disable CA1822 // Only (unused but required) setters are static
 74        /// <summary>
 75        /// Join Select so it can be sent as a comma separated string.
 76        /// </summary>
 77        [CodeGenMember("select")]
 78        internal string SelectRaw
 79        {
 2880            get => Select.CommaJoin();
 081            set => throw new InvalidOperationException($"Cannot deserialize {nameof(SuggestOptions)}.");
 82        }
 83        #pragma warning restore CA1822
 84
 85        /// <summary>
 86        /// The number of suggestions to retrieve. This must be a value between
 87        /// 1 and 100. The default is 5.
 88        /// </summary>
 89        [CodeGenMember("top")]
 7890        public int? Size { get; set; }
 91
 92        /// <summary>
 93        /// The list of OData $orderby expressions by which to sort the
 94        /// results. Each expression can be either a field name or a call to
 95        /// either the geo.distance() or the search.score() functions.  Each
 96        /// expression can be followed by asc to indicate ascending, or desc
 97        /// to indicate descending. The default is ascending order. Ties will
 98        /// be broken by the match scores of documents. If no $orderby is
 99        /// specified, the default sort order is descending by document match
 100        /// score. There can be at most 32 $orderby clauses.
 101        /// </summary>
 142102        public IList<string> OrderBy { get; internal set; } = new List<string>();
 103
 104        #pragma warning disable CA1822 // Only (unused but required) setters are static
 105        /// <summary>
 106        /// Join OrderBy so it can be sent as a comma separated string.
 107        /// </summary>
 108        [CodeGenMember("orderby")]
 109        internal string OrderByRaw
 110        {
 38111            get => OrderBy.CommaJoin();
 0112            set => throw new InvalidOperationException($"Cannot deserialize {nameof(SuggestOptions)}.");
 113        }
 114        #pragma warning restore CA1822
 115
 116        /// <summary>
 117        /// Creates a shallow copy of the SuggestOptions.
 118        /// </summary>
 119        /// <returns>The cloned SuggestOptions.</returns>
 120        internal SuggestOptions Clone() =>
 22121            new SuggestOptions
 22122            {
 22123                SearchText = SearchText,
 22124                SuggesterName = SuggesterName,
 22125                Filter = Filter,
 22126                SearchFields = SearchFields,
 22127                Select = Select,
 22128                Size = Size,
 22129                OrderBy = OrderBy,
 22130                HighlightPostTag = HighlightPostTag,
 22131                HighlightPreTag = HighlightPreTag,
 22132                MinimumCoverage = MinimumCoverage,
 22133                UseFuzzyMatching = UseFuzzyMatching,
 22134            };
 135    }
 136}