Skip to content

Commit 5f9fdbc

Browse files
committed
Added fields block (docvalue_fields) to SuggestOption #4148
Copied from Hit.cs (cherry picked from commit 45c4d60)
1 parent a1b5c7e commit 5f9fdbc

File tree

1 file changed

+39
-31
lines changed

1 file changed

+39
-31
lines changed

src/Nest/Search/Suggesters/SuggestOption.cs

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,108 +14,116 @@ public interface ISuggestOption<out TDocument> where TDocument : class
1414
/// <summary>
1515
/// Phrase suggestions only, true if matching documents for the collate query were found,
1616
/// </summary>
17-
[DataMember(Name ="collate_match")]
17+
[DataMember(Name = "collate_match")]
1818
bool CollateMatch { get; }
1919

2020
/// <summary>
2121
/// Completion suggester only, the contexts associated with the completed document
2222
/// </summary>
23-
[DataMember(Name ="contexts")]
23+
[DataMember(Name = "contexts")]
2424
IDictionary<string, IEnumerable<Context>> Contexts { get; }
2525

26+
// TODO this should be reported to elastic/elasticsearch
27+
[DataMember(Name = "_score")]
28+
double? DocumentScore { get; }
29+
30+
/// <inheritdoc />
31+
[DataMember(Name = "fields")]
32+
FieldValues Fields { get; }
33+
2634
/// <summary>
2735
/// Term suggester only
2836
/// </summary>
29-
[DataMember(Name ="freq")]
37+
[DataMember(Name = "freq")]
3038
long Frequency { get; set; }
3139

3240
/// <summary>
3341
/// Phrase suggester only, highlighted version of text
3442
/// </summary>
35-
[DataMember(Name ="highlighted")]
43+
[DataMember(Name = "highlighted")]
3644
string Highlighted { get; }
3745

3846
/// <summary>
3947
/// Completion suggester only, the id of the completed document
4048
/// </summary>
41-
[DataMember(Name ="_id")]
49+
[DataMember(Name = "_id")]
4250
string Id { get; }
4351

4452
/// <summary>
4553
/// Completion suggester only, the index of the completed document
4654
/// </summary>
47-
[DataMember(Name ="_index")]
55+
[DataMember(Name = "_index")]
4856
IndexName Index { get; }
4957

50-
/// <summary> Either the <see cref="DocumentScore"/> or the <see cref="SuggestScore"/></summary>
58+
/// <summary> Either the <see cref="DocumentScore" /> or the <see cref="SuggestScore" /></summary>
5159
[IgnoreDataMember]
5260
double Score { get; }
5361

5462
/// <summary>
5563
/// Completion suggester only, the source of the completed document
5664
/// </summary>
57-
[DataMember(Name ="_source")]
65+
[DataMember(Name = "_source")]
5866
[JsonFormatter(typeof(SourceFormatter<>))]
5967
TDocument Source { get; }
6068

61-
[DataMember(Name ="text")]
62-
string Text { get; }
63-
64-
// TODO this should be reported to elastic/elasticsearch
65-
[DataMember(Name = "_score")]
66-
double? DocumentScore { get; }
67-
68-
[DataMember(Name ="score")]
69+
[DataMember(Name = "score")]
6970
double? SuggestScore { get; }
71+
72+
[DataMember(Name = "text")]
73+
string Text { get; }
7074
}
7175

7276
/// <inheritdoc />
7377
public class SuggestOption<TDocument> : ISuggestOption<TDocument>
7478
where TDocument : class
7579
{
7680
/// <inheritdoc />
77-
[DataMember(Name ="collate_match")]
81+
[DataMember(Name = "collate_match")]
7882
public bool CollateMatch { get; internal set; }
7983

8084
/// <inheritdoc />
81-
[DataMember(Name ="contexts")]
85+
[DataMember(Name = "contexts")]
8286
public IDictionary<string, IEnumerable<Context>> Contexts { get; internal set; }
8387

8488
/// <inheritdoc />
85-
[DataMember(Name ="freq")]
89+
[DataMember(Name = "_score")]
90+
public double? DocumentScore { get; internal set; }
91+
92+
/// <inheritdoc />
93+
[DataMember(Name = "fields")]
94+
public FieldValues Fields { get; internal set; }
95+
96+
/// <inheritdoc />
97+
[DataMember(Name = "freq")]
8698
public long Frequency { get; set; }
8799

88100
/// <inheritdoc />
89-
[DataMember(Name ="highlighted")]
101+
[DataMember(Name = "highlighted")]
90102
public string Highlighted { get; internal set; }
91103

92104
/// <inheritdoc />
93-
[DataMember(Name ="_id")]
105+
[DataMember(Name = "_id")]
94106
public string Id { get; internal set; }
95107

96108
/// <inheritdoc />
97-
[DataMember(Name ="_index")]
109+
[DataMember(Name = "_index")]
98110
public IndexName Index { get; internal set; }
99111

100112
/// <inheritdoc />
101113
[IgnoreDataMember]
102114
public double Score => DocumentScore ?? SuggestScore ?? 0;
103115

104116
/// <inheritdoc />
105-
[DataMember(Name ="_source")]
117+
[DataMember(Name = "_source")]
106118
[JsonFormatter(typeof(SourceFormatter<>))]
107119
public TDocument Source { get; internal set; }
108120

109121
/// <inheritdoc />
110-
[DataMember(Name ="text")]
111-
public string Text { get; internal set; }
112-
113-
/// <inheritdoc />
114-
[DataMember(Name = "_score")]
115-
public double? DocumentScore { get; internal set; }
122+
[DataMember(Name = "score")]
123+
public double? SuggestScore { get; internal set; }
116124

117125
/// <inheritdoc />
118-
[DataMember(Name ="score")]
119-
public double? SuggestScore { get; internal set; }
126+
[DataMember(Name = "text")]
127+
public string Text { get; internal set; }
120128
}
121129
}

0 commit comments

Comments
 (0)