Skip to content

Commit 353b26b

Browse files
authored
Add max_analyzed_offset to highlight (#5383)
1 parent 422da5a commit 353b26b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Nest/Search/Search/Highlighting/Highlight.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ public interface IHighlight
7979
[DataMember(Name = "highlight_query")]
8080
QueryContainer HighlightQuery { get; set; }
8181

82+
/// <summary>
83+
/// If this setting is set to a non-negative value, the highlighting stops at this defined maximum limit, and the
84+
/// rest of the text is not processed, thus not highlighted and no error is returned.
85+
/// </summary>
86+
[DataMember(Name ="max_analyzed_offset")]
87+
int? MaxAnalyzedOffset { get; set; }
88+
8289
[DataMember(Name ="max_fragment_length")]
8390
int? MaxFragmentLength { get; set; }
8491

@@ -178,6 +185,9 @@ public class Highlight : IHighlight
178185
/// <inheritdoc/>
179186
public QueryContainer HighlightQuery { get; set; }
180187

188+
/// <inheritdoc/>
189+
public int? MaxAnalyzedOffset { get; set; }
190+
181191
/// <inheritdoc/>
182192
public int? MaxFragmentLength { get; set; }
183193

@@ -224,6 +234,7 @@ public class HighlightDescriptor<T> : DescriptorBase<HighlightDescriptor<T>, IHi
224234
int? IHighlight.FragmentOffset { get; set; }
225235
int? IHighlight.FragmentSize { get; set; }
226236
QueryContainer IHighlight.HighlightQuery { get; set; }
237+
int? IHighlight.MaxAnalyzedOffset { get; set; }
227238
int? IHighlight.MaxFragmentLength { get; set; }
228239
int? IHighlight.NoMatchSize { get; set; }
229240
int? IHighlight.NumberOfFragments { get; set; }
@@ -288,6 +299,9 @@ public HighlightDescriptor<T> HighlightQuery(Func<QueryContainerDescriptor<T>, Q
288299
/// <inheritdoc cref="IHighlight.BoundaryMaxScan" />
289300
public HighlightDescriptor<T> BoundaryMaxScan(int? boundaryMaxScan) => Assign(boundaryMaxScan, (a, v) => a.BoundaryMaxScan = v);
290301

302+
/// <inheritdoc cref="IHighlight.MaxAnalyzedOffset" />
303+
public HighlightDescriptor<T> MaxAnalyzedOffset(int? maxAnalyzedOffset) => Assign(maxAnalyzedOffset, (a, v) => a.MaxAnalyzedOffset = v);
304+
291305
/// <inheritdoc cref="IHighlight.MaxFragmentLength" />
292306
public HighlightDescriptor<T> MaxFragmentLength(int? maxFragmentLength) => Assign(maxFragmentLength, (a, v) => a.MaxFragmentLength = v);
293307

0 commit comments

Comments
 (0)