Skip to content

Commit bd12e00

Browse files
committed
Update versions in SearchSortValues transport serialization
Now that #36617 is backported to 6.x, the version in the transport serialization conditionals for the search sort values can be updated to 6.6.0
1 parent 1aad08c commit bd12e00

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public SearchSortValues(Object[] rawSortValues, DocValueFormat[] sortValueFormat
6767

6868
SearchSortValues(StreamInput in) throws IOException {
6969
this.formattedSortValues = in.readArray(Lucene::readSortValue, Object[]::new);
70-
if (in.getVersion().onOrAfter(Version.V_7_0_0)) {
70+
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
7171
this.rawSortValues = in.readArray(Lucene::readSortValue, Object[]::new);
7272
} else {
7373
this.rawSortValues = EMPTY_ARRAY;
@@ -77,7 +77,7 @@ public SearchSortValues(Object[] rawSortValues, DocValueFormat[] sortValueFormat
7777
@Override
7878
public void writeTo(StreamOutput out) throws IOException {
7979
out.writeArray(Lucene::writeSortValue, this.formattedSortValues);
80-
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
80+
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
8181
out.writeArray(Lucene::writeSortValue, this.rawSortValues);
8282
}
8383
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,17 @@ protected SearchSortValues mutateInstance(SearchSortValues instance) {
136136
return new SearchSortValues(values);
137137
}
138138

139-
//TODO rename and update version after backport
140-
public void testSerializationPre70() throws IOException {
141-
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0));
139+
public void testSerializationPre6_6_0() throws IOException {
140+
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_6_6_0));
142141
SearchSortValues original = createTestInstance();
143142
SearchSortValues deserialized = copyInstance(original, version);
144143
assertArrayEquals(original.getFormattedSortValues(), deserialized.getFormattedSortValues());
145144
assertEquals(0, deserialized.getRawSortValues().length);
146145
}
147146

148-
//TODO rename method and adapt versions after backport
149-
public void testReadFromPre70() throws IOException {
147+
public void testReadFromPre6_6_0() throws IOException {
150148
try (StreamInput in = StreamInput.wrap(Base64.getDecoder().decode("AwIAAAABAQEyBUAIAAAAAAAAAAAAAAAA"))) {
151-
in.setVersion(VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0)));
149+
in.setVersion(VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_6_6_0)));
152150
SearchSortValues deserialized = new SearchSortValues(in);
153151
SearchSortValues expected = new SearchSortValues(new Object[]{1, "2", 3d});
154152
assertEquals(expected, deserialized);

0 commit comments

Comments
 (0)