Skip to content

Commit

Permalink
Add max_analyzed_offset to highlight (#5383)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejgordon authored Mar 2, 2021
1 parent 422da5a commit 353b26b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Nest/Search/Search/Highlighting/Highlight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ public interface IHighlight
[DataMember(Name = "highlight_query")]
QueryContainer HighlightQuery { get; set; }

/// <summary>
/// If this setting is set to a non-negative value, the highlighting stops at this defined maximum limit, and the
/// rest of the text is not processed, thus not highlighted and no error is returned.
/// </summary>
[DataMember(Name ="max_analyzed_offset")]
int? MaxAnalyzedOffset { get; set; }

[DataMember(Name ="max_fragment_length")]
int? MaxFragmentLength { get; set; }

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

/// <inheritdoc/>
public int? MaxAnalyzedOffset { get; set; }

/// <inheritdoc/>
public int? MaxFragmentLength { get; set; }

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

/// <inheritdoc cref="IHighlight.MaxAnalyzedOffset" />
public HighlightDescriptor<T> MaxAnalyzedOffset(int? maxAnalyzedOffset) => Assign(maxAnalyzedOffset, (a, v) => a.MaxAnalyzedOffset = v);

/// <inheritdoc cref="IHighlight.MaxFragmentLength" />
public HighlightDescriptor<T> MaxFragmentLength(int? maxFragmentLength) => Assign(maxFragmentLength, (a, v) => a.MaxFragmentLength = v);

Expand Down

0 comments on commit 353b26b

Please sign in to comment.