Skip to content

Commit 6568f65

Browse files
junweid62Junwei Dai
authored andcommitted
Updates version to fix BWC for SearchSourceBuilder (opensearch-project#17098)
* change version to 2.19 Signed-off-by: Junwei Dai <[email protected]> * bring back the constructor InternalSearchResponse and SearchResponseSections Signed-off-by: Junwei Dai <[email protected]> --------- Signed-off-by: Junwei Dai <[email protected]> Co-authored-by: Junwei Dai <[email protected]> Signed-off-by: expani <[email protected]>
1 parent 978d761 commit 6568f65

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

server/src/main/java/org/opensearch/action/search/SearchResponseSections.java

+23
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,29 @@ public SearchResponseSections(
121121
this.searchExtBuilders.addAll(Objects.requireNonNull(searchExtBuilders, "searchExtBuilders must not be null"));
122122
}
123123

124+
public SearchResponseSections(
125+
SearchHits hits,
126+
Aggregations aggregations,
127+
Suggest suggest,
128+
boolean timedOut,
129+
Boolean terminatedEarly,
130+
SearchProfileShardResults profileResults,
131+
int numReducePhases,
132+
List<SearchExtBuilder> searchExtBuilders
133+
) {
134+
this(
135+
hits,
136+
aggregations,
137+
suggest,
138+
timedOut,
139+
terminatedEarly,
140+
profileResults,
141+
numReducePhases,
142+
searchExtBuilders,
143+
Collections.emptyList()
144+
);
145+
}
146+
124147
public final boolean timedOut() {
125148
return this.timedOut;
126149
}

server/src/main/java/org/opensearch/search/builder/SearchSourceBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public SearchSourceBuilder(StreamInput in) throws IOException {
305305
if (in.getVersion().onOrAfter(Version.V_2_18_0)) {
306306
searchPipeline = in.readOptionalString();
307307
}
308-
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
308+
if (in.getVersion().onOrAfter(Version.V_2_19_0)) {
309309
verbosePipeline = in.readBoolean();
310310
}
311311
}
@@ -391,7 +391,7 @@ public void writeTo(StreamOutput out) throws IOException {
391391
if (out.getVersion().onOrAfter(Version.V_2_18_0)) {
392392
out.writeOptionalString(searchPipeline);
393393
}
394-
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
394+
if (out.getVersion().onOrAfter(Version.V_2_19_0)) {
395395
out.writeBoolean(verbosePipeline);
396396
}
397397
}

server/src/main/java/org/opensearch/search/internal/InternalSearchResponse.java

+26-2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,30 @@ public InternalSearchResponse(
111111
);
112112
}
113113

114+
public InternalSearchResponse(
115+
SearchHits hits,
116+
InternalAggregations aggregations,
117+
Suggest suggest,
118+
SearchProfileShardResults profileResults,
119+
boolean timedOut,
120+
Boolean terminatedEarly,
121+
int numReducePhases,
122+
List<SearchExtBuilder> searchExtBuilderList
123+
124+
) {
125+
super(
126+
hits,
127+
aggregations,
128+
suggest,
129+
timedOut,
130+
terminatedEarly,
131+
profileResults,
132+
numReducePhases,
133+
searchExtBuilderList,
134+
Collections.emptyList()
135+
);
136+
}
137+
114138
public InternalSearchResponse(StreamInput in) throws IOException {
115139
super(
116140
new SearchHits(in),
@@ -149,11 +173,11 @@ private static void writeSearchExtBuildersOnOrAfter(StreamOutput out, List<Searc
149173
}
150174

151175
private static List<ProcessorExecutionDetail> readProcessorResultOnOrAfter(StreamInput in) throws IOException {
152-
return (in.getVersion().onOrAfter(Version.V_3_0_0)) ? in.readList(ProcessorExecutionDetail::new) : Collections.emptyList();
176+
return (in.getVersion().onOrAfter(Version.V_2_19_0)) ? in.readList(ProcessorExecutionDetail::new) : Collections.emptyList();
153177
}
154178

155179
private static void writeProcessorResultOnOrAfter(StreamOutput out, List<ProcessorExecutionDetail> processorResult) throws IOException {
156-
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
180+
if (out.getVersion().onOrAfter(Version.V_2_19_0)) {
157181
out.writeList(processorResult);
158182
}
159183
}

0 commit comments

Comments
 (0)