@@ -68,17 +68,10 @@ public interface IHighlightField
68
68
int ? BoundaryMaxScan { get ; set ; }
69
69
70
70
/// <summary>
71
- /// Define how highlighted text will be encoded.
72
- /// It can be either default (no encoding) or html (will escape html, if you use html highlighting tags).
73
- /// </summary>
74
- [ JsonProperty ( "encoder" ) ]
75
- string Encoder { get ; set ; }
76
-
77
- /// <summary>
78
- /// The order in which highlighted fragments are sorted
71
+ /// The order in which highlighted fragments are sorted. Only valid for the unified highlighter.
79
72
/// </summary>
80
73
[ JsonProperty ( "order" ) ]
81
- string Order { get ; set ; }
74
+ HighlighterOrder ? Order { get ; set ; }
82
75
83
76
/// <summary>
84
77
/// Use a specific "tag" schemas.
@@ -91,7 +84,7 @@ public interface IHighlightField
91
84
/// <em class="hlt10">
92
85
/// </remarks>
93
86
[ JsonProperty ( "tags_schema" ) ]
94
- string TagsSchema { get ; set ; }
87
+ HighlighterTagsSchema ? TagsSchema { get ; set ; }
95
88
96
89
/// <summary>
97
90
/// Determines if only fields that hold a query match will be highlighted. Set to <c>false</c>
@@ -129,6 +122,7 @@ public interface IHighlightField
129
122
/// </summary>
130
123
[ JsonProperty ( "fragmenter" ) ]
131
124
HighlighterFragmenter ? Fragmenter { get ; set ; }
125
+
132
126
/// <summary>
133
127
/// The type of highlighter to use. Can be a defined or custom highlighter
134
128
/// </summary>
@@ -155,6 +149,15 @@ public interface IHighlightField
155
149
/// </summary>
156
150
[ JsonProperty ( "highlight_query" ) ]
157
151
QueryContainer HighlightQuery { get ; set ; }
152
+
153
+ /// <summary>
154
+ /// Controls the number of matching phrases in a document that are considered. Prevents the
155
+ /// <see cref="HighlighterType.Fvh"/> highlighter from analyzing too many phrases and consuming too much memory.
156
+ /// When using matched_fields, <see cref="PhraseLimit"/> phrases per matched field are considered. Raising the limit increases query time
157
+ /// and consumes more memory. Only supported by the <see cref="HighlighterType.Fvh"/> highlighter. Defaults to 256.
158
+ /// </summary>
159
+ [ JsonProperty ( "phrase_limit" ) ]
160
+ int ? PhraseLimit { get ; set ; }
158
161
}
159
162
160
163
public class HighlightField : IHighlightField
@@ -176,11 +179,9 @@ public class HighlightField : IHighlightField
176
179
/// <inheritdoc/>
177
180
public int ? BoundaryMaxScan { get ; set ; }
178
181
/// <inheritdoc/>
179
- public string Encoder { get ; set ; }
182
+ public HighlighterOrder ? Order { get ; set ; }
180
183
/// <inheritdoc/>
181
- public string Order { get ; set ; }
182
- /// <inheritdoc/>
183
- public string TagsSchema { get ; set ; }
184
+ public HighlighterTagsSchema ? TagsSchema { get ; set ; }
184
185
/// <inheritdoc/>
185
186
public bool ? RequireFieldMatch { get ; set ; }
186
187
/// <inheritdoc/>
@@ -201,6 +202,8 @@ public class HighlightField : IHighlightField
201
202
public Fields MatchedFields { get ; set ; }
202
203
/// <inheritdoc/>
203
204
public QueryContainer HighlightQuery { get ; set ; }
205
+ /// <inheritdoc/>
206
+ public int ? PhraseLimit { get ; set ; }
204
207
}
205
208
206
209
public class HighlightFieldDescriptor < T > : DescriptorBase < HighlightFieldDescriptor < T > , IHighlightField > , IHighlightField
@@ -214,9 +217,8 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
214
217
int ? IHighlightField . NumberOfFragments { get ; set ; }
215
218
int ? IHighlightField . FragmentOffset { get ; set ; }
216
219
int ? IHighlightField . BoundaryMaxScan { get ; set ; }
217
- string IHighlightField . Encoder { get ; set ; }
218
- string IHighlightField . Order { get ; set ; }
219
- string IHighlightField . TagsSchema { get ; set ; }
220
+ HighlighterOrder ? IHighlightField . Order { get ; set ; }
221
+ HighlighterTagsSchema ? IHighlightField . TagsSchema { get ; set ; }
220
222
bool ? IHighlightField . RequireFieldMatch { get ; set ; }
221
223
string IHighlightField . BoundaryChars { get ; set ; }
222
224
int ? IHighlightField . MaxFragmentLength { get ; set ; }
@@ -227,6 +229,7 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
227
229
bool ? IHighlightField . ForceSource { get ; set ; }
228
230
Fields IHighlightField . MatchedFields { get ; set ; }
229
231
QueryContainer IHighlightField . HighlightQuery { get ; set ; }
232
+ int ? IHighlightField . PhraseLimit { get ; set ; }
230
233
231
234
/// <inheritdoc/>
232
235
public HighlightFieldDescriptor < T > Field ( Field field ) => Assign ( a => a . Field = field ) ;
@@ -238,7 +241,7 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
238
241
public HighlightFieldDescriptor < T > AllField ( ) => this . Field ( "_all" ) ;
239
242
240
243
/// <inheritdoc/>
241
- public HighlightFieldDescriptor < T > TagsSchema ( string schema = "styled" ) => Assign ( a => a . TagsSchema = schema ) ;
244
+ public HighlightFieldDescriptor < T > TagsSchema ( HighlighterTagsSchema ? schema ) => Assign ( a => a . TagsSchema = schema ) ;
242
245
243
246
/// <inheritdoc/>
244
247
public HighlightFieldDescriptor < T > ForceSource ( bool ? force = true ) => Assign ( a => a . ForceSource = force ) ;
@@ -274,10 +277,7 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
274
277
public HighlightFieldDescriptor < T > FragmentOffset ( int ? fragmentOffset ) => Assign ( a => a . FragmentOffset = fragmentOffset ) ;
275
278
276
279
/// <inheritdoc/>
277
- public HighlightFieldDescriptor < T > Encoder ( string encoder ) => Assign ( a => a . Encoder = encoder ) ;
278
-
279
- /// <inheritdoc/>
280
- public HighlightFieldDescriptor < T > Order ( string order ) => Assign ( a => a . Order = order ) ;
280
+ public HighlightFieldDescriptor < T > Order ( HighlighterOrder ? order ) => Assign ( a => a . Order = order ) ;
281
281
282
282
/// <inheritdoc/>
283
283
public HighlightFieldDescriptor < T > RequireFieldMatch ( bool ? requireFieldMatch = true ) => Assign ( a => a . RequireFieldMatch = requireFieldMatch ) ;
@@ -307,5 +307,8 @@ public HighlightFieldDescriptor<T> HighlightQuery(Func<QueryContainerDescriptor<
307
307
308
308
/// <inheritdoc/>
309
309
public HighlightFieldDescriptor < T > Fragmenter ( HighlighterFragmenter ? fragmenter ) => Assign ( a => a . Fragmenter = fragmenter ) ;
310
+
311
+ /// <inheritdoc/>
312
+ public HighlightFieldDescriptor < T > PhraseLimit ( int phraseLimit ) => Assign ( a => a . PhraseLimit = phraseLimit ) ;
310
313
}
311
314
}
0 commit comments