Skip to content

Commit

Permalink
Add BWC checks in serialized object (opensearch-project#11733)
Browse files Browse the repository at this point in the history
  • Loading branch information
brusic committed Nov 5, 2024
1 parent 6752def commit 8116fca
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.search.aggregations.bucket.adjacency;

import org.opensearch.Version;
import org.opensearch.core.ParseField;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -187,7 +188,9 @@ public AdjacencyMatrixAggregationBuilder(StreamInput in) throws IOException {
super(in);
int filtersSize = in.readVInt();
separator = in.readString();
showOnlyIntersecting = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
showOnlyIntersecting = in.readBoolean();
}
filters = new ArrayList<>(filtersSize);
for (int i = 0; i < filtersSize; i++) {
filters.add(new KeyedFilter(in));
Expand All @@ -198,7 +201,9 @@ public AdjacencyMatrixAggregationBuilder(StreamInput in) throws IOException {
protected void doWriteTo(StreamOutput out) throws IOException {
out.writeVInt(filters.size());
out.writeString(separator);
out.writeBoolean(showOnlyIntersecting);
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
out.writeBoolean(showOnlyIntersecting);
}
for (KeyedFilter keyedFilter : filters) {
keyedFilter.writeTo(out);
}
Expand Down

0 comments on commit 8116fca

Please sign in to comment.