| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Collections.Generic; |
| | | 6 | | using System.Linq; |
| | | 7 | | using Azure.Core; |
| | | 8 | | |
| | | 9 | | namespace Azure.Search.Documents.Indexes.Models |
| | | 10 | | { |
| | | 11 | | [CodeGenModel("Suggester")] |
| | | 12 | | public partial class SearchSuggester |
| | | 13 | | { |
| | | 14 | | private const string AnalyzingInfixMatching = "analyzingInfixMatching"; |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Creates a new instance of the <see cref="SearchSuggester"/> class. |
| | | 18 | | /// </summary> |
| | | 19 | | /// <param name="name">The name of the suggester.</param> |
| | | 20 | | /// <param name="sourceFields">The list of field names to which the suggester applies. Each field must be search |
| | | 21 | | /// <exception cref="ArgumentException"><paramref name="name"/> is an empty string.</exception> |
| | | 22 | | /// <exception cref="ArgumentNullException"><paramref name="name"/> or <paramref name="sourceFields"/> is null.< |
| | 7 | 23 | | public SearchSuggester(string name, IEnumerable<string> sourceFields) |
| | | 24 | | { |
| | 7 | 25 | | Argument.AssertNotNullOrEmpty(name, nameof(name)); |
| | 7 | 26 | | Argument.AssertNotNullOrEmpty(sourceFields, nameof(sourceFields)); |
| | | 27 | | |
| | 7 | 28 | | Name = name; |
| | 7 | 29 | | SourceFields = sourceFields.ToList(); |
| | 7 | 30 | | } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Creates a new instance of the <see cref="SearchSuggester"/> class. |
| | | 34 | | /// </summary> |
| | | 35 | | /// <param name="name">The name of the suggester.</param> |
| | | 36 | | /// <param name="sourceFields">The list of field names to which the suggester applies. Each field must be search |
| | | 37 | | /// <exception cref="ArgumentException"><paramref name="name"/> is an empty string.</exception> |
| | | 38 | | /// <exception cref="ArgumentNullException"><paramref name="name"/> or <paramref name="sourceFields"/> is null.< |
| | 7 | 39 | | public SearchSuggester(string name, params string[] sourceFields) : this(name, (IEnumerable<string>)sourceFields |
| | | 40 | | { |
| | 7 | 41 | | } |
| | | 42 | | |
| | | 43 | | /// <summary> The list of field names to which the suggester applies. Each field must be searchable. </summary> |
| | 9 | 44 | | public IList<string> SourceFields { get; } |
| | | 45 | | |
| | | 46 | | [CodeGenMember("searchMode")] |
| | 31 | 47 | | private string SearchMode { get; } = AnalyzingInfixMatching; |
| | | 48 | | } |
| | | 49 | | } |