Skip to content

Commit b018a97

Browse files
committed
Change RequireFieldMatch to bool? with default value
1 parent 56d9166 commit b018a97

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

docs/search/request/highlighting-usage.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ s => s
3535
.Highlight(h => h
3636
.PreTags("<tag1>")
3737
.PostTags("</tag1>")
38+
.Encoder(HighlighterEncoder.Html)
3839
.Fields(
3940
fs => fs
4041
.Field(p => p.Name.Suffix("standard"))
@@ -50,6 +51,7 @@ s => s
5051
.PreTags("<name>")
5152
.PostTags("</name>")
5253
.BoundaryMaxScan(50)
54+
.PhraseLimit(10)
5355
.HighlightQuery(q => q
5456
.Match(m => m
5557
.Field(p => p.LeadDeveloper.FirstName)
@@ -87,6 +89,7 @@ new SearchRequest<Project>
8789
{
8890
PreTags = new[] { "<tag1>" },
8991
PostTags = new[] { "</tag1>" },
92+
Encoder = HighlighterEncoder.Html,
9093
Fields = new Dictionary<Field, IHighlightField>
9194
{
9295
{ "name.standard", new HighlightField
@@ -102,6 +105,7 @@ new SearchRequest<Project>
102105
{ "leadDeveloper.firstName", new HighlightField
103106
{
104107
Type = "fvh",
108+
PhraseLimit = 10,
105109
BoundaryMaxScan = 50,
106110
PreTags = new[] { "<name>"},
107111
PostTags = new[] { "</name>"},
@@ -147,6 +151,7 @@ new SearchRequest<Project>
147151
"post_tags": [
148152
"</tag1>"
149153
],
154+
"encoder": "html",
150155
"fields": {
151156
"name.standard": {
152157
"type": "plain",
@@ -158,6 +163,7 @@ new SearchRequest<Project>
158163
},
159164
"leadDeveloper.firstName": {
160165
"type": "fvh",
166+
"phrase_limit": 10,
161167
"boundary_max_scan": 50,
162168
"pre_tags": [
163169
"<name>"

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ public HighlightDescriptor<T> Fields(params Func<HighlightFieldDescriptor<T>, IH
221221
public HighlightDescriptor<T> PostTags(IEnumerable<string> postTags) => Assign(a => a.PostTags = postTags.ToListOrNullIfEmpty());
222222

223223
// <inheritdoc/>
224-
public HighlightDescriptor<T> FragmentSize(int fragmentSize) => Assign(a => a.FragmentSize = fragmentSize);
224+
public HighlightDescriptor<T> FragmentSize(int? fragmentSize) => Assign(a => a.FragmentSize = fragmentSize);
225225

226226
// <inheritdoc/>
227-
public HighlightDescriptor<T> NumberOfFragments(int numberOfFragments) => Assign(a => a.NumberOfFragments = numberOfFragments);
227+
public HighlightDescriptor<T> NumberOfFragments(int? numberOfFragments) => Assign(a => a.NumberOfFragments = numberOfFragments);
228228

229229
// <inheritdoc/>
230-
public HighlightDescriptor<T> FragmentOffset(int fragmentOffset) => Assign(a => a.FragmentOffset = fragmentOffset);
230+
public HighlightDescriptor<T> FragmentOffset(int? fragmentOffset) => Assign(a => a.FragmentOffset = fragmentOffset);
231231

232232
// <inheritdoc/>
233233
public HighlightDescriptor<T> Encoder(HighlighterEncoder? encoder) => Assign(a => a.Encoder = encoder);
@@ -236,13 +236,13 @@ public HighlightDescriptor<T> Fields(params Func<HighlightFieldDescriptor<T>, IH
236236
public HighlightDescriptor<T> Order(HighlighterOrder? order) => Assign(a => a.Order = order);
237237

238238
// <inheritdoc/>
239-
public HighlightDescriptor<T> RequireFieldMatch(bool requireFieldMatch = true) => Assign(a => a.RequireFieldMatch = requireFieldMatch);
239+
public HighlightDescriptor<T> RequireFieldMatch(bool? requireFieldMatch = true) => Assign(a => a.RequireFieldMatch = requireFieldMatch);
240240

241241
// <inheritdoc/>
242242
public HighlightDescriptor<T> BoundaryCharacters(string boundaryCharacters) => Assign(a => a.BoundaryChars = boundaryCharacters);
243243

244244
// <inheritdoc/>
245-
public HighlightDescriptor<T> BoundaryMaxScan(int boundaryMaxScan) => Assign(a => a.BoundaryMaxScan = boundaryMaxScan);
245+
public HighlightDescriptor<T> BoundaryMaxScan(int? boundaryMaxScan) => Assign(a => a.BoundaryMaxScan = boundaryMaxScan);
246246

247247
// <inheritdoc/>
248248
public HighlightDescriptor<T> MaxFragmentLength(int? maxFragmentLength) => Assign(a => a.MaxFragmentLength = maxFragmentLength);

src/Nest/Search/Search/Highlighting/HighlighterTagsSchema.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public enum HighlighterTagsSchema
1414
/// Use a specific "tag" schemas.
1515
/// </summary>
1616
/// <remarks>
17-
/// Currently a single schema called "styled" with the following pre_tags:
18-
/// &lt;em class="hlt1"&gt;, &lt;em class="hlt2"&gt;, &lt;em class="hlt3"&gt;,
19-
/// &lt;em class="hlt4"&gt;, &lt;em class="hlt5"&gt;, &lt;em class="hlt6"&gt;,
20-
/// &lt;em class="hlt7"&gt;, &lt;em class="hlt8"&gt;, &lt;em class="hlt9"&gt;,
21-
/// &lt;em class="hlt10"&gt;
17+
/// <para>Currently a single schema called "styled" with the following pre_tags:</para>
18+
/// <para>&lt;em class="hlt1"&gt;, &lt;em class="hlt2"&gt;, &lt;em class="hlt3"&gt;,</para>
19+
/// <para>&lt;em class="hlt4"&gt;, &lt;em class="hlt5"&gt;, &lt;em class="hlt6"&gt;,</para>
20+
/// <para>&lt;em class="hlt7"&gt;, &lt;em class="hlt8"&gt;, &lt;em class="hlt9"&gt;,</para>
21+
/// <para>&lt;em class="hlt10"&gt;</para>
2222
/// </remarks>
2323
[EnumMember(Value = "styled")]
2424
Styled

0 commit comments

Comments
 (0)