@@ -68,17 +68,10 @@ public interface IHighlightField
6868 int ? BoundaryMaxScan { get ; set ; }
6969
7070 /// <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.
7972 /// </summary>
8073 [ JsonProperty ( "order" ) ]
81- string Order { get ; set ; }
74+ HighlighterOrder ? Order { get ; set ; }
8275
8376 /// <summary>
8477 /// Use a specific "tag" schemas.
@@ -91,7 +84,7 @@ public interface IHighlightField
9184 /// <em class="hlt10">
9285 /// </remarks>
9386 [ JsonProperty ( "tags_schema" ) ]
94- string TagsSchema { get ; set ; }
87+ HighlighterTagsSchema ? TagsSchema { get ; set ; }
9588
9689 /// <summary>
9790 /// Determines if only fields that hold a query match will be highlighted. Set to <c>false</c>
@@ -129,6 +122,7 @@ public interface IHighlightField
129122 /// </summary>
130123 [ JsonProperty ( "fragmenter" ) ]
131124 HighlighterFragmenter ? Fragmenter { get ; set ; }
125+
132126 /// <summary>
133127 /// The type of highlighter to use. Can be a defined or custom highlighter
134128 /// </summary>
@@ -155,6 +149,15 @@ public interface IHighlightField
155149 /// </summary>
156150 [ JsonProperty ( "highlight_query" ) ]
157151 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 ; }
158161 }
159162
160163 public class HighlightField : IHighlightField
@@ -176,11 +179,9 @@ public class HighlightField : IHighlightField
176179 /// <inheritdoc/>
177180 public int ? BoundaryMaxScan { get ; set ; }
178181 /// <inheritdoc/>
179- public string Encoder { get ; set ; }
182+ public HighlighterOrder ? Order { get ; set ; }
180183 /// <inheritdoc/>
181- public string Order { get ; set ; }
182- /// <inheritdoc/>
183- public string TagsSchema { get ; set ; }
184+ public HighlighterTagsSchema ? TagsSchema { get ; set ; }
184185 /// <inheritdoc/>
185186 public bool ? RequireFieldMatch { get ; set ; }
186187 /// <inheritdoc/>
@@ -201,6 +202,8 @@ public class HighlightField : IHighlightField
201202 public Fields MatchedFields { get ; set ; }
202203 /// <inheritdoc/>
203204 public QueryContainer HighlightQuery { get ; set ; }
205+ /// <inheritdoc/>
206+ public int ? PhraseLimit { get ; set ; }
204207 }
205208
206209 public class HighlightFieldDescriptor < T > : DescriptorBase < HighlightFieldDescriptor < T > , IHighlightField > , IHighlightField
@@ -214,9 +217,8 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
214217 int ? IHighlightField . NumberOfFragments { get ; set ; }
215218 int ? IHighlightField . FragmentOffset { get ; set ; }
216219 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 ; }
220222 bool ? IHighlightField . RequireFieldMatch { get ; set ; }
221223 string IHighlightField . BoundaryChars { get ; set ; }
222224 int ? IHighlightField . MaxFragmentLength { get ; set ; }
@@ -227,6 +229,7 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
227229 bool ? IHighlightField . ForceSource { get ; set ; }
228230 Fields IHighlightField . MatchedFields { get ; set ; }
229231 QueryContainer IHighlightField . HighlightQuery { get ; set ; }
232+ int ? IHighlightField . PhraseLimit { get ; set ; }
230233
231234 /// <inheritdoc/>
232235 public HighlightFieldDescriptor < T > Field ( Field field ) => Assign ( a => a . Field = field ) ;
@@ -238,7 +241,7 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
238241 public HighlightFieldDescriptor < T > AllField ( ) => this . Field ( "_all" ) ;
239242
240243 /// <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 ) ;
242245
243246 /// <inheritdoc/>
244247 public HighlightFieldDescriptor < T > ForceSource ( bool ? force = true ) => Assign ( a => a . ForceSource = force ) ;
@@ -274,10 +277,7 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
274277 public HighlightFieldDescriptor < T > FragmentOffset ( int ? fragmentOffset ) => Assign ( a => a . FragmentOffset = fragmentOffset ) ;
275278
276279 /// <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 ) ;
281281
282282 /// <inheritdoc/>
283283 public HighlightFieldDescriptor < T > RequireFieldMatch ( bool ? requireFieldMatch = true ) => Assign ( a => a . RequireFieldMatch = requireFieldMatch ) ;
@@ -307,5 +307,8 @@ public HighlightFieldDescriptor<T> HighlightQuery(Func<QueryContainerDescriptor<
307307
308308 /// <inheritdoc/>
309309 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 ) ;
310313 }
311314}
0 commit comments