From a93619c5dadc9fa447843ed84af726952ecde8c2 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Tue, 2 Mar 2021 14:28:59 +0000 Subject: [PATCH] Add max_analyzed_offset to highlight --- src/Nest/Search/Search/Highlighting/Highlight.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Nest/Search/Search/Highlighting/Highlight.cs b/src/Nest/Search/Search/Highlighting/Highlight.cs index 81ff47a779f..c6f08ae35ee 100644 --- a/src/Nest/Search/Search/Highlighting/Highlight.cs +++ b/src/Nest/Search/Search/Highlighting/Highlight.cs @@ -79,6 +79,13 @@ public interface IHighlight [DataMember(Name = "highlight_query")] QueryContainer HighlightQuery { get; set; } + /// + /// 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. + /// + [DataMember(Name ="max_analyzed_offset")] + int? MaxAnalyzedOffset { get; set; } + [DataMember(Name ="max_fragment_length")] int? MaxFragmentLength { get; set; } @@ -178,6 +185,9 @@ public class Highlight : IHighlight /// public QueryContainer HighlightQuery { get; set; } + /// + public int? MaxAnalyzedOffset { get; set; } + /// public int? MaxFragmentLength { get; set; } @@ -224,6 +234,7 @@ public class HighlightDescriptor : DescriptorBase, 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; } @@ -288,6 +299,9 @@ public HighlightDescriptor HighlightQuery(Func, Q /// public HighlightDescriptor BoundaryMaxScan(int? boundaryMaxScan) => Assign(boundaryMaxScan, (a, v) => a.BoundaryMaxScan = v); + /// + public HighlightDescriptor MaxAnalyzedOffset(int? maxAnalyzedOffset) => Assign(maxAnalyzedOffset, (a, v) => a.MaxAnalyzedOffset = v); + /// public HighlightDescriptor MaxFragmentLength(int? maxFragmentLength) => Assign(maxFragmentLength, (a, v) => a.MaxFragmentLength = v);