Skip to content

Commit c0c2127

Browse files
Add test for -1
1 parent 4ae0be1 commit c0c2127

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.highlight/30_max_analyzed_offset.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,24 @@ setup:
142142
body: {"query" : {"match" : {"field2" : "fox"}}, "highlight" : {"type" : "plain", "fields" : {"field2" : {}}, "max_analyzed_offset": 1}}
143143
- match: { hits.hits.0.highlight: null }
144144

145+
---
146+
"Plain highlighter with max_analyzed_offset = -1 should default to index analyze offset":
147+
148+
- requires:
149+
test_runner_features: [capabilities]
150+
capabilities:
151+
- method: GET
152+
path: /_search
153+
capabilities: [ max_analyzed_offset_default ]
154+
reason: Behavior of max_analyzed_offset query param changed in 8.18.
155+
156+
- do:
157+
search:
158+
rest_total_hits_as_int: true
159+
index: test1
160+
body: {"query" : {"match" : {"field2" : "fox"}}, "highlight" : {"type" : "plain", "fields" : {"field2" : {}}, "max_analyzed_offset": -1}}
161+
- match: {hits.hits.0.highlight.field2.0: "The quick brown <em>fox</em> went to the forest and saw another fox."}
162+
145163
---
146164
"Plain highlighter with max_analyzed_offset < -1 should FAIL":
147165

0 commit comments

Comments
 (0)