Skip to content

Commit 1aad08c

Browse files
committed
Update version in SearchHits transport serialization
Now that #36555 is backported to 6.x, the version in the transport serialization conditionals for sort and collapse info can be updated to 6.6.0
1 parent ec0dc2c commit 1aad08c

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

server/src/main/java/org/elasticsearch/search/SearchHits.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ public void readFrom(StreamInput in) throws IOException {
243243
hits[i] = SearchHit.readSearchHit(in);
244244
}
245245
}
246-
//TODO update version once backported
247-
if (in.getVersion().onOrAfter(Version.V_7_0_0)) {
246+
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
248247
sortFields = in.readOptionalArray(Lucene::readSortField, SortField[]::new);
249248
collapseField = in.readOptionalString();
250249
collapseValues = in.readOptionalArray(Lucene::readSortValue, Object[]::new);
@@ -265,8 +264,7 @@ public void writeTo(StreamOutput out) throws IOException {
265264
hit.writeTo(out);
266265
}
267266
}
268-
//TODO update version once backported
269-
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
267+
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
270268
out.writeOptionalArray(Lucene::writeSortField, sortFields);
271269
out.writeOptionalString(collapseField);
272270
out.writeOptionalArray(Lucene::writeSortValue, collapseValues);

server/src/test/java/org/elasticsearch/search/SearchHitsTests.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,9 @@ public void testFromXContentWithShards() throws IOException {
271271
}
272272
}
273273

274-
//TODO rename method and adapt versions after backport
275-
public void testReadFromPre70() throws IOException {
274+
public void testReadFromPre6_6_0() throws IOException {
276275
try (StreamInput in = StreamInput.wrap(Base64.getDecoder().decode("AQC/gAAAAAA="))) {
277-
in.setVersion(VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0)));
276+
in.setVersion(VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_6_6_0)));
278277
SearchHits searchHits = new SearchHits();
279278
searchHits.readFrom(in);
280279
assertEquals(0, searchHits.getHits().length);
@@ -288,9 +287,8 @@ public void testReadFromPre70() throws IOException {
288287
}
289288
}
290289

291-
//TODO rename method and adapt versions after backport
292-
public void testSerializationPre70() throws IOException {
293-
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0));
290+
public void testSerializationPre6_6_0() throws IOException {
291+
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_6_6_0));
294292
SearchHits original = createTestItem(randomFrom(XContentType.values()), false, true, TotalHits.Relation.EQUAL_TO);
295293
SearchHits deserialized = copyInstance(original, version);
296294
assertArrayEquals(original.getHits(), deserialized.getHits());

0 commit comments

Comments
 (0)