Skip to content

Commit 0092c49

Browse files
Atri SharmaAtri Sharma
authored andcommitted
More cleanup
Signed-off-by: Atri Sharma <atrisharma@Atris-Mac-Studio.local>
1 parent e9c1472 commit 0092c49

17 files changed

+67
-1439
lines changed

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

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,6 @@ protected void onQueryFailure(int shardIndex, SearchShardTarget shardTarget, Exc
110110
*/
111111
protected void onPartialReduce(List<SearchShard> shards, TotalHits totalHits, InternalAggregations aggs, int reducePhase) {}
112112

113-
/**
114-
* Executed when a partial reduce with TopDocs is created for streaming search.
115-
*
116-
* @param shards The list of shards that are part of this reduce.
117-
* @param totalHits The total number of hits in this reduce.
118-
* @param topDocs The partial TopDocs result (may be null if no docs).
119-
* @param aggs The partial result for aggregations.
120-
* @param reducePhase The version number for this reduce.
121-
*/
122-
protected void onPartialReduceWithTopDocs(
123-
List<SearchShard> shards,
124-
TotalHits totalHits,
125-
org.apache.lucene.search.TopDocs topDocs,
126-
InternalAggregations aggs,
127-
int reducePhase
128-
) {
129-
// Default implementation delegates to the original method for backward compatibility
130-
onPartialReduce(shards, totalHits, aggs, reducePhase);
131-
}
132113

133114
/**
134115
* Executed once when the final reduce is created.
@@ -206,19 +187,6 @@ final void notifyPartialReduce(List<SearchShard> shards, TotalHits totalHits, In
206187
}
207188
}
208189

209-
final void notifyPartialReduceWithTopDocs(
210-
List<SearchShard> shards,
211-
TotalHits totalHits,
212-
org.apache.lucene.search.TopDocs topDocs,
213-
InternalAggregations aggs,
214-
int reducePhase
215-
) {
216-
try {
217-
onPartialReduceWithTopDocs(shards, totalHits, topDocs, aggs, reducePhase);
218-
} catch (Exception e) {
219-
logger.warn(() -> new ParameterizedMessage("Failed to execute progress listener on partial reduce with TopDocs"), e);
220-
}
221-
}
222190

223191
protected final void notifyFinalReduce(List<SearchShard> shards, TotalHits totalHits, InternalAggregations aggs, int reducePhase) {
224192
try {

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

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ public class SearchRequest extends ActionRequest implements IndicesRequest.Repla
128128

129129
private Boolean phaseTook = null;
130130

131-
private boolean streamingScoring = false;
132-
private String streamingSearchMode = null; // Will use StreamingSearchMode.NO_SCORING if null
131+
132+
// Null means no explicit streaming mode on the request.
133+
private String streamingSearchMode = null;
133134

134135
public SearchRequest() {
135136
this.localClusterAlias = null;
@@ -149,7 +150,7 @@ public SearchRequest(SearchRequest searchRequest) {
149150
searchRequest.finalReduce
150151
);
151152
// Preserve streaming fields when cloning
152-
this.streamingScoring = searchRequest.streamingScoring;
153+
153154
this.streamingSearchMode = searchRequest.streamingSearchMode;
154155
}
155156

@@ -240,7 +241,7 @@ private SearchRequest(
240241
this.cancelAfterTimeInterval = searchRequest.cancelAfterTimeInterval;
241242
this.phaseTook = searchRequest.phaseTook;
242243
// Preserve streaming fields for forked/sub-requests
243-
this.streamingScoring = searchRequest.streamingScoring;
244+
244245
this.streamingSearchMode = searchRequest.streamingSearchMode;
245246
}
246247

@@ -291,10 +292,8 @@ public SearchRequest(StreamInput in) throws IOException {
291292
}
292293
// Read streaming fields - gated on version for BWC
293294
if (in.getVersion().onOrAfter(Version.V_3_3_0)) {
294-
streamingScoring = in.readBoolean();
295295
streamingSearchMode = in.readOptionalString();
296296
} else {
297-
streamingScoring = false;
298297
streamingSearchMode = null;
299298
}
300299
}
@@ -333,7 +332,6 @@ public void writeTo(StreamOutput out) throws IOException {
333332
}
334333
// Write streaming fields - gated on version for BWC
335334
if (out.getVersion().onOrAfter(Version.V_3_3_0)) {
336-
out.writeBoolean(streamingScoring);
337335
out.writeOptionalString(streamingSearchMode);
338336
}
339337
}
@@ -717,20 +715,6 @@ public void setPhaseTook(Boolean phaseTook) {
717715
this.phaseTook = phaseTook;
718716
}
719717

720-
/**
721-
* Enable streaming scoring for this search request.
722-
*/
723-
public void setStreamingScoring(boolean streamingScoring) {
724-
this.streamingScoring = streamingScoring;
725-
}
726-
727-
/**
728-
* Check if streaming scoring is enabled for this search request.
729-
*/
730-
public boolean isStreamingScoring() {
731-
return streamingScoring;
732-
}
733-
734718
/**
735719
* Sets the streaming search mode for this request.
736720
* @param mode The streaming search mode to use
@@ -858,7 +842,8 @@ public boolean equals(Object o) {
858842
&& ccsMinimizeRoundtrips == that.ccsMinimizeRoundtrips
859843
&& Objects.equals(cancelAfterTimeInterval, that.cancelAfterTimeInterval)
860844
&& Objects.equals(pipeline, that.pipeline)
861-
&& Objects.equals(phaseTook, that.phaseTook);
845+
&& Objects.equals(phaseTook, that.phaseTook)
846+
&& Objects.equals(streamingSearchMode, that.streamingSearchMode);
862847
}
863848

864849
@Override
@@ -880,7 +865,8 @@ public int hashCode() {
880865
absoluteStartMillis,
881866
ccsMinimizeRoundtrips,
882867
cancelAfterTimeInterval,
883-
phaseTook
868+
phaseTook,
869+
streamingSearchMode
884870
);
885871
}
886872

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@ public XContentBuilder innerToXContent(XContentBuilder builder, Params params) t
355355
if (getNumReducePhases() != 1) {
356356
builder.field(NUM_REDUCE_PHASES.getPreferredName(), getNumReducePhases());
357357
}
358-
359358
RestActions.buildBroadcastShardsHeader(
360359
builder,
361360
params,

0 commit comments

Comments
 (0)