Skip to content

Commit a40c6da

Browse files
Cleanup dead code in o.e.search and o.e.a.search (#124445)
Just some obvious cleanups for stuff that became unused as of late.
1 parent 29ac261 commit a40c6da

File tree

18 files changed

+15
-81
lines changed

18 files changed

+15
-81
lines changed

server/src/main/java/org/elasticsearch/action/search/CCSSingleCoordinatorSearchProgressListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void onPartialReduce(List<SearchShard> shards, TotalHits totalHits, Inter
188188

189189
for (Map.Entry<String, Integer> entry : totalByClusterAlias.entrySet()) {
190190
String clusterAlias = entry.getKey();
191-
int successfulCount = entry.getValue().intValue();
191+
int successfulCount = entry.getValue();
192192

193193
clusters.swapCluster(clusterAlias, (k, v) -> {
194194
SearchResponse.Cluster.Status status = v.getStatus();
@@ -231,7 +231,7 @@ public void onFinalReduce(List<SearchShard> shards, TotalHits totalHits, Interna
231231

232232
for (Map.Entry<String, Integer> entry : totalByClusterAlias.entrySet()) {
233233
String clusterAlias = entry.getKey();
234-
int successfulCount = entry.getValue().intValue();
234+
int successfulCount = entry.getValue();
235235

236236
clusters.swapCluster(clusterAlias, (k, v) -> {
237237
SearchResponse.Cluster.Status status = v.getStatus();

server/src/main/java/org/elasticsearch/action/search/CountOnlyQueryPhaseResultConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
* store any other information.
2828
*/
2929
class CountOnlyQueryPhaseResultConsumer extends SearchPhaseResults<SearchPhaseResult> {
30-
AtomicReference<TotalHits.Relation> relationAtomicReference = new AtomicReference<>(TotalHits.Relation.EQUAL_TO);
31-
LongAdder totalHits = new LongAdder();
30+
final AtomicReference<TotalHits.Relation> relationAtomicReference = new AtomicReference<>(TotalHits.Relation.EQUAL_TO);
31+
final LongAdder totalHits = new LongAdder();
3232

3333
private final AtomicBoolean terminatedEarly = new AtomicBoolean(false);
3434
private final AtomicBoolean timedOut = new AtomicBoolean(false);

server/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,6 @@ public SearchRequestBuilder setWaitForCheckpoints(Map<String, long[]> waitForChe
121121
return this;
122122
}
123123

124-
/**
125-
* Set the timeout for the {@link #setWaitForCheckpoints(Map)} request.
126-
*/
127-
public SearchRequestBuilder setWaitForCheckpointsTimeout(final TimeValue waitForCheckpointsTimeout) {
128-
request.setWaitForCheckpointsTimeout(waitForCheckpointsTimeout);
129-
return this;
130-
}
131-
132124
/**
133125
* Specifies what type of requested indices to ignore and wildcard indices expressions.
134126
* <p>

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

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ public boolean hasPartialResults() {
786786
* for tracking search Cluster details.
787787
*/
788788
public boolean hasClusterObjects() {
789-
return clusterInfo.keySet().size() > 0;
789+
return clusterInfo.isEmpty() == false;
790790
}
791791

792792
/**
@@ -855,27 +855,6 @@ public Cluster(String clusterAlias, String indexExpression, boolean skipUnavaila
855855
this(clusterAlias, indexExpression, skipUnavailable, Status.RUNNING, null, null, null, null, null, null, false);
856856
}
857857

858-
/**
859-
* Create a Cluster with a new Status and one or more ShardSearchFailures. This constructor
860-
* should only be used for fatal failures where shard counters (total, successful, skipped, failed)
861-
* are not known (unset).
862-
* @param clusterAlias clusterAlias as defined in the remote cluster settings or RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY
863-
* for the local cluster
864-
* @param indexExpression the original (not resolved/concrete) indices expression provided for this cluster.
865-
* @param skipUnavailable whether cluster is marked as skip_unavailable in remote cluster settings
866-
* @param status current status of the search on this Cluster
867-
* @param failures list of failures that occurred during the search on this Cluster
868-
*/
869-
public Cluster(
870-
String clusterAlias,
871-
String indexExpression,
872-
boolean skipUnavailable,
873-
Status status,
874-
List<ShardSearchFailure> failures
875-
) {
876-
this(clusterAlias, indexExpression, skipUnavailable, status, null, null, null, null, failures, null, false);
877-
}
878-
879858
public Cluster(
880859
String clusterAlias,
881860
String indexExpression,
@@ -1034,7 +1013,7 @@ public void writeTo(StreamOutput out) throws IOException {
10341013
@Override
10351014
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
10361015
String name = clusterAlias;
1037-
if (clusterAlias.equals("")) {
1016+
if (clusterAlias.isEmpty()) {
10381017
name = LOCAL_CLUSTER_NAME_REPRESENTATION;
10391018
}
10401019
builder.startObject(name);

server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalDateRange.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import org.elasticsearch.common.io.stream.StreamInput;
1212
import org.elasticsearch.search.DocValueFormat;
13-
import org.elasticsearch.search.aggregations.InternalAggregation;
1413
import org.elasticsearch.search.aggregations.InternalAggregations;
1514

1615
import java.io.IOException;
@@ -25,10 +24,6 @@ public class InternalDateRange extends InternalRange<InternalDateRange.Bucket, I
2524

2625
public static class Bucket extends InternalRange.Bucket {
2726

28-
public Bucket(String key, double from, double to, long docCount, List<InternalAggregation> aggregations, DocValueFormat formatter) {
29-
super(key, from, to, docCount, InternalAggregations.from(aggregations), formatter);
30-
}
31-
3227
public Bucket(String key, double from, double to, long docCount, InternalAggregations aggregations, DocValueFormat formatter) {
3328
super(key, from, to, docCount, aggregations, formatter);
3429
}

server/src/main/java/org/elasticsearch/search/builder/PointInTimeBuilder.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,6 @@ public PointInTimeBuilder setKeepAlive(TimeValue keepAlive) {
124124
return this;
125125
}
126126

127-
/**
128-
* If specified, the search layer will keep this point in time around for at least the given keep-alive.
129-
* Otherwise, the point in time will be kept around until the original keep alive elapsed.
130-
*/
131-
public PointInTimeBuilder setKeepAlive(String keepAlive) {
132-
return setKeepAlive(TimeValue.parseTimeValue(keepAlive, "keep_alive"));
133-
}
134-
135127
@Nullable
136128
public TimeValue getKeepAlive() {
137129
return keepAlive;

server/src/main/java/org/elasticsearch/search/fetch/FetchContext.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.elasticsearch.search.fetch;
1111

1212
import org.apache.lucene.search.Query;
13-
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
1413
import org.elasticsearch.index.mapper.SourceFieldMapper;
1514
import org.elasticsearch.index.mapper.SourceLoader;
1615
import org.elasticsearch.index.query.ParsedQuery;
@@ -88,10 +87,6 @@ private static StoredFieldsContext buildStoredFieldsContext(SearchContext in) {
8887
return sfc;
8988
}
9089

91-
public BitsetFilterCache bitsetFilterCache() {
92-
return searchContext.bitsetFilterCache();
93-
}
94-
9590
/**
9691
* The name of the index that documents are being fetched from
9792
*/

server/src/main/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightBuilder.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -327,17 +327,6 @@ private static void transferOptions(
327327
}
328328
}
329329

330-
static Character[] convertCharArray(char[] array) {
331-
if (array == null) {
332-
return null;
333-
}
334-
Character[] charArray = new Character[array.length];
335-
for (int i = 0; i < array.length; i++) {
336-
charArray[i] = array[i];
337-
}
338-
return charArray;
339-
}
340-
341330
@Override
342331
public void innerXContent(XContentBuilder builder) throws IOException {
343332
// first write common options

server/src/main/java/org/elasticsearch/search/retriever/KnnRetrieverBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public final class KnnRetrieverBuilder extends RetrieverBuilder {
9696
RESCORE_VECTOR_FIELD,
9797
ObjectParser.ValueType.OBJECT
9898
);
99-
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
99+
RetrieverBuilder.declareBaseParserFields(PARSER);
100100
}
101101

102102
public static KnnRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {

server/src/main/java/org/elasticsearch/search/retriever/RescorerRetrieverBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public final class RescorerRetrieverBuilder extends CompoundRetrieverBuilder<Res
6464
);
6565
}
6666
}, RESCORE_FIELD, ObjectParser.ValueType.OBJECT_ARRAY);
67-
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
67+
RetrieverBuilder.declareBaseParserFields(PARSER);
6868
}
6969

7070
public static RescorerRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {

0 commit comments

Comments
 (0)