mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
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.
This commit is contained in:
parent
29ac2611fe
commit
a40c6da0d8
18 changed files with 15 additions and 81 deletions
|
@ -188,7 +188,7 @@ public class CCSSingleCoordinatorSearchProgressListener extends SearchProgressLi
|
|||
|
||||
for (Map.Entry<String, Integer> entry : totalByClusterAlias.entrySet()) {
|
||||
String clusterAlias = entry.getKey();
|
||||
int successfulCount = entry.getValue().intValue();
|
||||
int successfulCount = entry.getValue();
|
||||
|
||||
clusters.swapCluster(clusterAlias, (k, v) -> {
|
||||
SearchResponse.Cluster.Status status = v.getStatus();
|
||||
|
@ -231,7 +231,7 @@ public class CCSSingleCoordinatorSearchProgressListener extends SearchProgressLi
|
|||
|
||||
for (Map.Entry<String, Integer> entry : totalByClusterAlias.entrySet()) {
|
||||
String clusterAlias = entry.getKey();
|
||||
int successfulCount = entry.getValue().intValue();
|
||||
int successfulCount = entry.getValue();
|
||||
|
||||
clusters.swapCluster(clusterAlias, (k, v) -> {
|
||||
SearchResponse.Cluster.Status status = v.getStatus();
|
||||
|
|
|
@ -27,8 +27,8 @@ import java.util.stream.Stream;
|
|||
* store any other information.
|
||||
*/
|
||||
class CountOnlyQueryPhaseResultConsumer extends SearchPhaseResults<SearchPhaseResult> {
|
||||
AtomicReference<TotalHits.Relation> relationAtomicReference = new AtomicReference<>(TotalHits.Relation.EQUAL_TO);
|
||||
LongAdder totalHits = new LongAdder();
|
||||
final AtomicReference<TotalHits.Relation> relationAtomicReference = new AtomicReference<>(TotalHits.Relation.EQUAL_TO);
|
||||
final LongAdder totalHits = new LongAdder();
|
||||
|
||||
private final AtomicBoolean terminatedEarly = new AtomicBoolean(false);
|
||||
private final AtomicBoolean timedOut = new AtomicBoolean(false);
|
||||
|
|
|
@ -121,14 +121,6 @@ public class SearchRequestBuilder extends ActionRequestBuilder<SearchRequest, Se
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the timeout for the {@link #setWaitForCheckpoints(Map)} request.
|
||||
*/
|
||||
public SearchRequestBuilder setWaitForCheckpointsTimeout(final TimeValue waitForCheckpointsTimeout) {
|
||||
request.setWaitForCheckpointsTimeout(waitForCheckpointsTimeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies what type of requested indices to ignore and wildcard indices expressions.
|
||||
* <p>
|
||||
|
|
|
@ -786,7 +786,7 @@ public class SearchResponse extends ActionResponse implements ChunkedToXContentO
|
|||
* for tracking search Cluster details.
|
||||
*/
|
||||
public boolean hasClusterObjects() {
|
||||
return clusterInfo.keySet().size() > 0;
|
||||
return clusterInfo.isEmpty() == false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -855,27 +855,6 @@ public class SearchResponse extends ActionResponse implements ChunkedToXContentO
|
|||
this(clusterAlias, indexExpression, skipUnavailable, Status.RUNNING, null, null, null, null, null, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Cluster with a new Status and one or more ShardSearchFailures. This constructor
|
||||
* should only be used for fatal failures where shard counters (total, successful, skipped, failed)
|
||||
* are not known (unset).
|
||||
* @param clusterAlias clusterAlias as defined in the remote cluster settings or RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY
|
||||
* for the local cluster
|
||||
* @param indexExpression the original (not resolved/concrete) indices expression provided for this cluster.
|
||||
* @param skipUnavailable whether cluster is marked as skip_unavailable in remote cluster settings
|
||||
* @param status current status of the search on this Cluster
|
||||
* @param failures list of failures that occurred during the search on this Cluster
|
||||
*/
|
||||
public Cluster(
|
||||
String clusterAlias,
|
||||
String indexExpression,
|
||||
boolean skipUnavailable,
|
||||
Status status,
|
||||
List<ShardSearchFailure> failures
|
||||
) {
|
||||
this(clusterAlias, indexExpression, skipUnavailable, status, null, null, null, null, failures, null, false);
|
||||
}
|
||||
|
||||
public Cluster(
|
||||
String clusterAlias,
|
||||
String indexExpression,
|
||||
|
@ -1034,7 +1013,7 @@ public class SearchResponse extends ActionResponse implements ChunkedToXContentO
|
|||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
String name = clusterAlias;
|
||||
if (clusterAlias.equals("")) {
|
||||
if (clusterAlias.isEmpty()) {
|
||||
name = LOCAL_CLUSTER_NAME_REPRESENTATION;
|
||||
}
|
||||
builder.startObject(name);
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.elasticsearch.search.aggregations.bucket.range;
|
|||
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -25,10 +24,6 @@ public class InternalDateRange extends InternalRange<InternalDateRange.Bucket, I
|
|||
|
||||
public static class Bucket extends InternalRange.Bucket {
|
||||
|
||||
public Bucket(String key, double from, double to, long docCount, List<InternalAggregation> aggregations, DocValueFormat formatter) {
|
||||
super(key, from, to, docCount, InternalAggregations.from(aggregations), formatter);
|
||||
}
|
||||
|
||||
public Bucket(String key, double from, double to, long docCount, InternalAggregations aggregations, DocValueFormat formatter) {
|
||||
super(key, from, to, docCount, aggregations, formatter);
|
||||
}
|
||||
|
|
|
@ -124,14 +124,6 @@ public final class PointInTimeBuilder implements Writeable, ToXContentFragment {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If specified, the search layer will keep this point in time around for at least the given keep-alive.
|
||||
* Otherwise, the point in time will be kept around until the original keep alive elapsed.
|
||||
*/
|
||||
public PointInTimeBuilder setKeepAlive(String keepAlive) {
|
||||
return setKeepAlive(TimeValue.parseTimeValue(keepAlive, "keep_alive"));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TimeValue getKeepAlive() {
|
||||
return keepAlive;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
package org.elasticsearch.search.fetch;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||
import org.elasticsearch.index.mapper.SourceFieldMapper;
|
||||
import org.elasticsearch.index.mapper.SourceLoader;
|
||||
import org.elasticsearch.index.query.ParsedQuery;
|
||||
|
@ -88,10 +87,6 @@ public class FetchContext {
|
|||
return sfc;
|
||||
}
|
||||
|
||||
public BitsetFilterCache bitsetFilterCache() {
|
||||
return searchContext.bitsetFilterCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the index that documents are being fetched from
|
||||
*/
|
||||
|
|
|
@ -327,17 +327,6 @@ public final class HighlightBuilder extends AbstractHighlighterBuilder<Highlight
|
|||
}
|
||||
}
|
||||
|
||||
static Character[] convertCharArray(char[] array) {
|
||||
if (array == null) {
|
||||
return null;
|
||||
}
|
||||
Character[] charArray = new Character[array.length];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
charArray[i] = array[i];
|
||||
}
|
||||
return charArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void innerXContent(XContentBuilder builder) throws IOException {
|
||||
// first write common options
|
||||
|
|
|
@ -96,7 +96,7 @@ public final class KnnRetrieverBuilder extends RetrieverBuilder {
|
|||
RESCORE_VECTOR_FIELD,
|
||||
ObjectParser.ValueType.OBJECT
|
||||
);
|
||||
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
|
||||
RetrieverBuilder.declareBaseParserFields(PARSER);
|
||||
}
|
||||
|
||||
public static KnnRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
|
||||
|
|
|
@ -64,7 +64,7 @@ public final class RescorerRetrieverBuilder extends CompoundRetrieverBuilder<Res
|
|||
);
|
||||
}
|
||||
}, RESCORE_FIELD, ObjectParser.ValueType.OBJECT_ARRAY);
|
||||
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
|
||||
RetrieverBuilder.declareBaseParserFields(PARSER);
|
||||
}
|
||||
|
||||
public static RescorerRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
|
||||
|
|
|
@ -55,10 +55,7 @@ public abstract class RetrieverBuilder implements Rewriteable<RetrieverBuilder>,
|
|||
|
||||
public static final ParseField NAME_FIELD = new ParseField("_name");
|
||||
|
||||
protected static void declareBaseParserFields(
|
||||
String name,
|
||||
AbstractObjectParser<? extends RetrieverBuilder, RetrieverParserContext> parser
|
||||
) {
|
||||
protected static void declareBaseParserFields(AbstractObjectParser<? extends RetrieverBuilder, RetrieverParserContext> parser) {
|
||||
parser.declareObjectArray(
|
||||
(r, v) -> r.preFilterQueryBuilders = new ArrayList<>(v),
|
||||
(p, c) -> AbstractQueryBuilder.parseTopLevelQuery(p, c::trackQueryUsage),
|
||||
|
|
|
@ -74,7 +74,7 @@ public final class StandardRetrieverBuilder extends RetrieverBuilder implements
|
|||
COLLAPSE_FIELD,
|
||||
ObjectParser.ValueType.OBJECT
|
||||
);
|
||||
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
|
||||
RetrieverBuilder.declareBaseParserFields(PARSER);
|
||||
}
|
||||
|
||||
public static StandardRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
package org.elasticsearch.search.suggest.phrase;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.MultiTerms;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.index.TermsEnum;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
@ -30,10 +29,6 @@ public abstract class WordScorer {
|
|||
private final TermsEnum termsEnum;
|
||||
private final boolean useTotalTermFreq;
|
||||
|
||||
public WordScorer(IndexReader reader, String field, double realWordLikelihood, BytesRef separator) throws IOException {
|
||||
this(reader, MultiTerms.getTerms(reader, field), field, realWordLikelihood, separator);
|
||||
}
|
||||
|
||||
public WordScorer(IndexReader reader, Terms terms, String field, double realWordLikelihood, BytesRef separator) throws IOException {
|
||||
if (terms == null) {
|
||||
throw new IllegalArgumentException("Field: [" + field + "] does not exist");
|
||||
|
|
|
@ -70,7 +70,7 @@ public final class QueryRuleRetrieverBuilder extends CompoundRetrieverBuilder<Qu
|
|||
return innerRetriever;
|
||||
}, RETRIEVER_FIELD);
|
||||
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
|
||||
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
|
||||
RetrieverBuilder.declareBaseParserFields(PARSER);
|
||||
}
|
||||
|
||||
public static QueryRuleRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RandomRankRetrieverBuilder extends RetrieverBuilder {
|
|||
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
|
||||
PARSER.declareInt(optionalConstructorArg(), SEED_FIELD);
|
||||
|
||||
RetrieverBuilder.declareBaseParserFields(RandomRankBuilder.NAME, PARSER);
|
||||
RetrieverBuilder.declareBaseParserFields(PARSER);
|
||||
}
|
||||
|
||||
public static RandomRankRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class TextSimilarityRankRetrieverBuilder extends CompoundRetrieverBuilder
|
|||
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
|
||||
PARSER.declareBoolean(optionalConstructorArg(), FAILURES_ALLOWED_FIELD);
|
||||
|
||||
RetrieverBuilder.declareBaseParserFields(TextSimilarityRankBuilder.NAME, PARSER);
|
||||
RetrieverBuilder.declareBaseParserFields(PARSER);
|
||||
}
|
||||
|
||||
public static TextSimilarityRankRetrieverBuilder fromXContent(
|
||||
|
|
|
@ -79,7 +79,7 @@ public final class LinearRetrieverBuilder extends CompoundRetrieverBuilder<Linea
|
|||
static {
|
||||
PARSER.declareObjectArray(constructorArg(), LinearRetrieverComponent::fromXContent, RETRIEVERS_FIELD);
|
||||
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
|
||||
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
|
||||
RetrieverBuilder.declareBaseParserFields(PARSER);
|
||||
}
|
||||
|
||||
private static float[] getDefaultWeight(int size) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public final class RRFRetrieverBuilder extends CompoundRetrieverBuilder<RRFRetri
|
|||
}, RETRIEVERS_FIELD);
|
||||
PARSER.declareInt(optionalConstructorArg(), RANK_WINDOW_SIZE_FIELD);
|
||||
PARSER.declareInt(optionalConstructorArg(), RANK_CONSTANT_FIELD);
|
||||
RetrieverBuilder.declareBaseParserFields(NAME, PARSER);
|
||||
RetrieverBuilder.declareBaseParserFields(PARSER);
|
||||
}
|
||||
|
||||
public static RRFRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue