| | | 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 | | |
| | | 11 | | namespace 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 | | /// Defines how the Suggest API should apply to a group of fields in the |
| | | 21 | | /// index. |
| | | 22 | | /// </summary> |
| | | 23 | | public partial class Suggester |
| | | 24 | | { |
| | | 25 | | /// <summary> |
| | | 26 | | /// Initializes a new instance of the Suggester class. |
| | | 27 | | /// </summary> |
| | 530 | 28 | | public Suggester() |
| | | 29 | | { |
| | | 30 | | CustomInit(); |
| | 530 | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Initializes a new instance of the Suggester class. |
| | | 35 | | /// </summary> |
| | | 36 | | /// <param name="name">The name of the suggester.</param> |
| | | 37 | | /// <param name="sourceFields">The list of field names to which the |
| | | 38 | | /// suggester applies. Each field must be searchable.</param> |
| | 518 | 39 | | public Suggester(string name, IList<string> sourceFields) |
| | | 40 | | { |
| | 518 | 41 | | Name = name; |
| | 518 | 42 | | SourceFields = sourceFields; |
| | | 43 | | CustomInit(); |
| | 518 | 44 | | } |
| | | 45 | | /// <summary> |
| | | 46 | | /// Static constructor for Suggester class. |
| | | 47 | | /// </summary> |
| | | 48 | | static Suggester() |
| | | 49 | | { |
| | 2 | 50 | | SearchMode = "analyzingInfixMatching"; |
| | 2 | 51 | | } |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// An initialization method that performs custom operations like setting defaults |
| | | 55 | | /// </summary> |
| | | 56 | | partial void CustomInit(); |
| | | 57 | | |
| | | 58 | | /// <summary> |
| | | 59 | | /// Gets or sets the name of the suggester. |
| | | 60 | | /// </summary> |
| | | 61 | | [JsonProperty(PropertyName = "name")] |
| | 2116 | 62 | | public string Name { get; set; } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Gets or sets the list of field names to which the suggester |
| | | 66 | | /// applies. Each field must be searchable. |
| | | 67 | | /// </summary> |
| | | 68 | | [JsonProperty(PropertyName = "sourceFields")] |
| | 2646 | 69 | | public IList<string> SourceFields { get; set; } |
| | | 70 | | |
| | | 71 | | /// <summary> |
| | | 72 | | /// A value indicating the capabilities of the suggester. |
| | | 73 | | /// </summary> |
| | | 74 | | [JsonProperty(PropertyName = "searchMode")] |
| | 1056 | 75 | | public static string SearchMode { get; private set; } |
| | | 76 | | |
| | | 77 | | /// <summary> |
| | | 78 | | /// Validate the object. |
| | | 79 | | /// </summary> |
| | | 80 | | /// <exception cref="ValidationException"> |
| | | 81 | | /// Thrown if validation fails |
| | | 82 | | /// </exception> |
| | | 83 | | public virtual void Validate() |
| | | 84 | | { |
| | 524 | 85 | | if (Name == null) |
| | | 86 | | { |
| | 0 | 87 | | throw new ValidationException(ValidationRules.CannotBeNull, "Name"); |
| | | 88 | | } |
| | 524 | 89 | | if (SourceFields == null) |
| | | 90 | | { |
| | 0 | 91 | | throw new ValidationException(ValidationRules.CannotBeNull, "SourceFields"); |
| | | 92 | | } |
| | 524 | 93 | | } |
| | | 94 | | } |
| | | 95 | | } |