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
This commit is contained in:
parent
1aad08c0c0
commit
bd12e00b53
|
@ -67,7 +67,7 @@ public class SearchSortValues implements ToXContentFragment, Writeable {
|
|||
|
||||
SearchSortValues(StreamInput in) throws IOException {
|
||||
this.formattedSortValues = in.readArray(Lucene::readSortValue, Object[]::new);
|
||||
if (in.getVersion().onOrAfter(Version.V_7_0_0)) {
|
||||
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
|
||||
this.rawSortValues = in.readArray(Lucene::readSortValue, Object[]::new);
|
||||
} else {
|
||||
this.rawSortValues = EMPTY_ARRAY;
|
||||
|
@ -77,7 +77,7 @@ public class SearchSortValues implements ToXContentFragment, Writeable {
|
|||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeArray(Lucene::writeSortValue, this.formattedSortValues);
|
||||
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
|
||||
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
|
||||
out.writeArray(Lucene::writeSortValue, this.rawSortValues);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,19 +136,17 @@ public class SearchSortValuesTests extends AbstractSerializingTestCase<SearchSor
|
|||
return new SearchSortValues(values);
|
||||
}
|
||||
|
||||
//TODO rename and update version after backport
|
||||
public void testSerializationPre70() throws IOException {
|
||||
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0));
|
||||
public void testSerializationPre6_6_0() throws IOException {
|
||||
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_6_6_0));
|
||||
SearchSortValues original = createTestInstance();
|
||||
SearchSortValues deserialized = copyInstance(original, version);
|
||||
assertArrayEquals(original.getFormattedSortValues(), deserialized.getFormattedSortValues());
|
||||
assertEquals(0, deserialized.getRawSortValues().length);
|
||||
}
|
||||
|
||||
//TODO rename method and adapt versions after backport
|
||||
public void testReadFromPre70() throws IOException {
|
||||
public void testReadFromPre6_6_0() throws IOException {
|
||||
try (StreamInput in = StreamInput.wrap(Base64.getDecoder().decode("AwIAAAABAQEyBUAIAAAAAAAAAAAAAAAA"))) {
|
||||
in.setVersion(VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0)));
|
||||
in.setVersion(VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_6_6_0)));
|
||||
SearchSortValues deserialized = new SearchSortValues(in);
|
||||
SearchSortValues expected = new SearchSortValues(new Object[]{1, "2", 3d});
|
||||
assertEquals(expected, deserialized);
|
||||
|
|
Loading…
Reference in New Issue