Skip to content

Commit cbf228d

Browse files
committed
Remove confidence based streaming
Signed-off-by: Atri Sharma <atri.jiit@gmail.com>
1 parent b4b16b0 commit cbf228d

13 files changed

+14
-561
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
* Batch reduction frequency is controlled by per-mode multipliers:
2727
* - NO_SCORING: Immediate reduction (batch size = 1) for fastest time-to-first-byte
2828
* - SCORED_UNSORTED: Small batches (minBatchReduceSize * 2)
29-
* - CONFIDENCE_BASED: Moderate batches (minBatchReduceSize * 3)
3029
* - SCORED_SORTED: Larger batches (minBatchReduceSize * 10)
3130
*
3231
* These multipliers are applied to the base batch reduce size (typically 5) to determine
@@ -97,9 +96,6 @@ int getBatchReduceSize(int requestBatchedReduceSize, int minBatchReduceSize) {
9796
case SCORED_UNSORTED:
9897
// Small batches for quick emission without sorting overhead
9998
return super.getBatchReduceSize(requestBatchedReduceSize, minBatchReduceSize * 2);
100-
case CONFIDENCE_BASED:
101-
// Moderate batching for progressive emission with confidence
102-
return super.getBatchReduceSize(requestBatchedReduceSize, minBatchReduceSize * 3);
10399
case SCORED_SORTED:
104100
// Higher batch size to collect more results before reducing (sorting is expensive)
105101
return super.getBatchReduceSize(requestBatchedReduceSize, minBatchReduceSize * 10);

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,7 @@ public SearchPhaseResult read(StreamInput in) throws IOException {
211211
fetchDocuments
212212
);
213213
}
214-
transportService.sendChildRequest(
215-
connection,
216-
QUERY_ACTION_NAME,
217-
request,
218-
task,
219-
transportHandler // TODO: wrap with ConnectionCountingHandler
220-
);
214+
transportService.sendChildRequest(connection, QUERY_ACTION_NAME, request, task, transportHandler);
221215
}
222216

223217
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
/**
2424
* SearchProgressListener implementation for streaming search with scoring.
25-
* Computes partial search results when confidence thresholds are met.
25+
* Computes partial search results progressively as shards complete.
2626
*
2727
* @opensearch.internal
2828
*/

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

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public static Milestone fromProgress(float progress) {
5959
private final long requestId;
6060
private final Milestone milestone;
6161
private final TopDocs topDocs;
62-
private final float confidence;
6362
private final ProgressStatistics statistics;
6463
private final boolean isFinal;
6564

@@ -70,7 +69,6 @@ public StreamingSearchProgressMessage() {
7069
this.requestId = -1;
7170
this.milestone = Milestone.INITIAL;
7271
this.topDocs = null;
73-
this.confidence = 0.0f;
7472
this.statistics = null;
7573
this.isFinal = false;
7674
}
@@ -81,7 +79,6 @@ public StreamingSearchProgressMessage(
8179
long requestId,
8280
Milestone milestone,
8381
TopDocs topDocs,
84-
float confidence,
8582
ProgressStatistics statistics,
8683
boolean isFinal
8784
) {
@@ -90,7 +87,6 @@ public StreamingSearchProgressMessage(
9087
this.requestId = requestId;
9188
this.milestone = milestone;
9289
this.topDocs = topDocs;
93-
this.confidence = confidence;
9490
this.statistics = statistics;
9591
this.isFinal = isFinal;
9692
}
@@ -113,7 +109,6 @@ public StreamingSearchProgressMessage(StreamInput in) throws IOException {
113109
}
114110
this.topDocs = new TopDocs(new TotalHits(totalHits, TotalHits.Relation.EQUAL_TO), scoreDocs);
115111

116-
this.confidence = in.readFloat();
117112
this.statistics = new ProgressStatistics(in);
118113
this.isFinal = in.readBoolean();
119114
}
@@ -133,7 +128,6 @@ public void writeTo(StreamOutput out) throws IOException {
133128
out.writeFloat(doc.score);
134129
}
135130

136-
out.writeFloat(confidence);
137131
statistics.writeTo(out);
138132
out.writeBoolean(isFinal);
139133
}
@@ -158,10 +152,6 @@ public TopDocs getTopDocs() {
158152
return topDocs;
159153
}
160154

161-
public float getConfidence() {
162-
return confidence;
163-
}
164-
165155
public ProgressStatistics getStatistics() {
166156
return statistics;
167157
}
@@ -270,7 +260,6 @@ public static class Builder {
270260
private long requestId;
271261
private Milestone milestone;
272262
private TopDocs topDocs;
273-
private float confidence = 0.0f;
274263
private ProgressStatistics statistics;
275264
private boolean isFinal = false;
276265

@@ -299,11 +288,6 @@ public Builder topDocs(TopDocs topDocs) {
299288
return this;
300289
}
301290

302-
public Builder confidence(float confidence) {
303-
this.confidence = confidence;
304-
return this;
305-
}
306-
307291
public Builder statistics(ProgressStatistics statistics) {
308292
this.statistics = statistics;
309293
return this;
@@ -315,16 +299,7 @@ public Builder isFinal(boolean isFinal) {
315299
}
316300

317301
public StreamingSearchProgressMessage build() {
318-
return new StreamingSearchProgressMessage(
319-
shardTarget,
320-
shardIndex,
321-
requestId,
322-
milestone,
323-
topDocs,
324-
confidence,
325-
statistics,
326-
isFinal
327-
);
302+
return new StreamingSearchProgressMessage(shardTarget, shardIndex, requestId, milestone, topDocs, statistics, isFinal);
328303
}
329304
}
330305
}

server/src/main/java/org/opensearch/search/query/HoeffdingBounds.java

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)