|
1 | | -namespace Nest |
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Linq.Expressions; |
| 5 | +using Newtonsoft.Json; |
| 6 | + |
| 7 | +namespace Nest |
2 | 8 | { |
3 | | - public partial interface IAnalyzeRequest { } |
| 9 | + [JsonConverter(typeof(ReadAsTypeJsonConverter<AnalyzeRequest>))] |
| 10 | + public partial interface IAnalyzeRequest |
| 11 | + { |
| 12 | + ///<summary>The name of the analyzer to use</summary> |
| 13 | + [JsonProperty("analyzer")] |
| 14 | + string Analyzer { get; set; } |
| 15 | + |
| 16 | + ///<summary>A collection of character filters to use for the analysis</summary> |
| 17 | + [Obsolete("Deprecated in 2.4.0. Will be removed in 5.0. Use CharFilter instead")] |
| 18 | + string[] CharFilters { get; set; } |
| 19 | + |
| 20 | + ///<summary>A collection of character filters to use for the analysis</summary> |
| 21 | + [JsonProperty("char_filter")] |
| 22 | + string[] CharFilter { get; set; } |
| 23 | + |
| 24 | + ///<summary>A collection of filters to use for the analysis</summary> |
| 25 | + [JsonProperty("filter")] |
| 26 | + string[] Filter { get; set; } |
| 27 | + |
| 28 | + ///<summary>Use the analyzer configured for this field (instead of passing the analyzer name)</summary> |
| 29 | + [JsonProperty("field")] |
| 30 | + Field Field { get; set; } |
| 31 | + |
| 32 | + ///<summary>A collection of filters to use for the analysis</summary> |
| 33 | + [Obsolete("Deprecated in 2.4.0. Will be removed in 5.0. Use Filter instead")] |
| 34 | + string[] Filters { get; set; } |
| 35 | + |
| 36 | + ///<summary>The text on which the analysis should be performed (when request body is not used)</summary> |
| 37 | + [JsonProperty("text")] |
| 38 | + string[] Text { get; set; } |
4 | 39 |
|
5 | | - public partial class AnalyzeRequest |
| 40 | + ///<summary>The name of the tokenizer to use for the analysis</summary> |
| 41 | + [JsonProperty("tokenizer")] |
| 42 | + string Tokenizer { get; set; } |
| 43 | + } |
| 44 | + |
| 45 | + public partial class AnalyzeRequest |
6 | 46 | { |
7 | 47 | public AnalyzeRequest(IndexName indices, string textToAnalyze) |
8 | 48 | :this(indices) |
9 | 49 | { |
10 | 50 | this.Text = new[] { textToAnalyze }; |
11 | 51 | } |
| 52 | + |
| 53 | + ///<summary>The name of the analyzer to use</summary> |
| 54 | + public string Analyzer { get; set; } |
| 55 | + |
| 56 | + ///<summary>A collection of character filters to use for the analysis</summary> |
| 57 | + [Obsolete("Will be removed in 5.0. Use CharFilter instead")] |
| 58 | + public string[] CharFilters { get { return CharFilter; } set { CharFilter = value; } } |
| 59 | + |
| 60 | + ///<summary>A collection of character filters to use for the analysis</summary> |
| 61 | + public string[] CharFilter { get; set; } |
| 62 | + |
| 63 | + ///<summary>A collection of filters to use for the analysis</summary> |
| 64 | + public string[] Filter { get; set; } |
| 65 | + |
| 66 | + ///<summary>Use the analyzer configured for this field (instead of passing the analyzer name)</summary> |
| 67 | + public Field Field { get; set; } |
| 68 | + |
| 69 | + ///<summary>A collection of filters to use for the analysis</summary> |
| 70 | + [Obsolete("Will be removed in 5.0. Use Filter instead")] |
| 71 | + public string[] Filters { get { return Filter; } set { Filter = value; } } |
| 72 | + |
| 73 | + ///<summary>The text on which the analysis should be performed</summary> |
| 74 | + public string[] Text { get; set; } |
| 75 | + |
| 76 | + ///<summary>The name of the tokenizer to use for the analysis</summary> |
| 77 | + public string Tokenizer { get; set; } |
12 | 78 | } |
13 | 79 |
|
14 | 80 | [DescriptorFor("IndicesAnalyze")] |
15 | | - public partial class AnalyzeDescriptor { } |
| 81 | + public partial class AnalyzeDescriptor |
| 82 | + { |
| 83 | + string IAnalyzeRequest.Analyzer { get; set; } |
| 84 | + string[] IAnalyzeRequest.CharFilters { get { return Self.CharFilter; } set { Self.CharFilter = value; } } |
| 85 | + string[] IAnalyzeRequest.CharFilter { get; set; } |
| 86 | + string[] IAnalyzeRequest.Filter { get; set; } |
| 87 | + Field IAnalyzeRequest.Field { get; set; } |
| 88 | + string[] IAnalyzeRequest.Filters { get { return Self.Filter; } set { Self.Filter = value; } } |
| 89 | + string[] IAnalyzeRequest.Text { get; set; } |
| 90 | + string IAnalyzeRequest.Tokenizer { get; set; } |
| 91 | + |
| 92 | + ///<summary>The name of the analyzer to use</summary> |
| 93 | + public AnalyzeDescriptor Analyzer(string analyser) => Assign(a => a.Analyzer = analyser); |
| 94 | + |
| 95 | + ///<summary>A collection of character filters to use for the analysis</summary> |
| 96 | + public AnalyzeDescriptor CharFilter(params string[] charFilter) => Assign(a => a.CharFilter = charFilter); |
| 97 | + |
| 98 | + ///<summary>A collection of character filters to use for the analysis</summary> |
| 99 | + public AnalyzeDescriptor CharFilter(IEnumerable<string> charFilter) => Assign(a => a.CharFilter = charFilter.ToArray()); |
| 100 | + |
| 101 | + ///<summary>A collection of filters to use for the analysis</summary> |
| 102 | + public AnalyzeDescriptor Filter(params string[] filter) => Assign(a => a.Filter = filter); |
| 103 | + |
| 104 | + ///<summary>A collection of filters to use for the analysis</summary> |
| 105 | + public AnalyzeDescriptor Filter(IEnumerable<string> filter) => Assign(a => a.Filter = filter.ToArray()); |
| 106 | + |
| 107 | + ///<summary>Use the analyzer configured for this field (instead of passing the analyzer name)</summary> |
| 108 | + public AnalyzeDescriptor Field(Field field) => Assign(a => a.Field = field); |
| 109 | + |
| 110 | + ///<summary>Use the analyzer configured for this field (instead of passing the analyzer name)</summary> |
| 111 | + public AnalyzeDescriptor Field<T>(Expression<Func<T, object>> field) => Assign(a => a.Field = field); |
| 112 | + |
| 113 | + ///<summary>The text on which the analysis should be performed</summary> |
| 114 | + public AnalyzeDescriptor Text(params string[] text) => Assign(a => a.Text = text); |
| 115 | + |
| 116 | + ///<summary>The text on which the analysis should be performed</summary> |
| 117 | + public AnalyzeDescriptor Text(IEnumerable<string> text) => Assign(a => a.Text = text.ToArray()); |
| 118 | + |
| 119 | + ///<summary>The name of the tokenizer to use for the analysis</summary> |
| 120 | + public AnalyzeDescriptor Tokenizer(string tokenizer) => Assign(a => a.Tokenizer = tokenizer); |
| 121 | + } |
16 | 122 | } |
0 commit comments