Skip to content

Commit 1fad902

Browse files
committed
Add support for 'no_match_size' to HighlightFieldDescriptor
1 parent 621f1cb commit 1fad902

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Nest/DSL/HighlightFieldDescriptor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class HighlightFieldDescriptor<T> where T : class
2121
[JsonProperty("fragment_size")]
2222
internal int? _FragmentSize { get; set; }
2323

24+
[JsonProperty("no_match_size")]
25+
internal int? _NoMatchSize { get; set; }
26+
2427
[JsonProperty("number_of_fragments")]
2528
internal int? _NumberOfFragments { get; set; }
2629

@@ -105,6 +108,11 @@ public HighlightFieldDescriptor<T> FragmentSize(int fragmentSize)
105108
this._FragmentSize = fragmentSize;
106109
return this;
107110
}
111+
public HighlightFieldDescriptor<T> NoMatchSize(int noMatchSize)
112+
{
113+
this._NoMatchSize = noMatchSize;
114+
return this;
115+
}
108116
public HighlightFieldDescriptor<T> NumberOfFragments(int numberOfFragments)
109117
{
110118
this._NumberOfFragments = numberOfFragments;

src/Tests/Nest.Tests.Unit/Search/Highlight/HighlightTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public void TestHighlight()
2626
.OnFields(
2727
f => f
2828
.OnAll()
29+
.NoMatchSize(200)
2930
.PreTags("<em>")
3031
.PostTags("</em>")
3132
)
@@ -46,7 +47,8 @@ public void TestHighlight()
4647
fields: {
4748
_all: {
4849
pre_tags: [""<em>""],
49-
post_tags: [""</em>""]
50+
post_tags: [""</em>""],
51+
no_match_size: 200
5052
}
5153
},
5254
require_field_match: true,

0 commit comments

Comments
 (0)