summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/federation
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/federation')
-rw-r--r--container-search/src/main/java/com/yahoo/search/federation/FederationResult.java11
-rw-r--r--container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java24
-rw-r--r--container-search/src/main/java/com/yahoo/search/federation/sourceref/SearchChainInvocationSpec.java8
3 files changed, 9 insertions, 34 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/federation/FederationResult.java b/container-search/src/main/java/com/yahoo/search/federation/FederationResult.java
index f6cbb49f7d5..89c45fde6ae 100644
--- a/container-search/src/main/java/com/yahoo/search/federation/FederationResult.java
+++ b/container-search/src/main/java/com/yahoo/search/federation/FederationResult.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.federation;
-import com.google.common.collect.ImmutableList;
import com.yahoo.search.Result;
import com.yahoo.search.searchchain.FutureResult;
@@ -27,9 +26,9 @@ class FederationResult {
* The remaining targets to wait for.
* Other targets are either complete, or should only be included if they are available when we complete
*/
- private List<TargetResult> targetsToWaitFor;
+ private final List<TargetResult> targetsToWaitFor;
- private FederationResult(ImmutableList<TargetResult> targetResults) {
+ private FederationResult(List<TargetResult> targetResults) {
this.targetResults = targetResults;
if (targetResults.stream().anyMatch(TargetResult::isMandatory))
@@ -94,7 +93,7 @@ class FederationResult {
public Optional<Result> getIfAvailable(long timeout) {
if (availableResult.isPresent()) return availableResult;
availableResult = futureResult.getIfAvailable(timeout, TimeUnit.MILLISECONDS);
- availableResult.ifPresent(result -> target.modifyTargetResult(result));
+ availableResult.ifPresent(target::modifyTargetResult);
return availableResult;
}
@@ -121,14 +120,14 @@ class FederationResult {
public static class Builder {
- private final ImmutableList.Builder<TargetResult> results = new ImmutableList.Builder();
+ private final List<TargetResult> results = new ArrayList<>();
public void add(FederationSearcher.Target target, FutureResult futureResult) {
results.add(new TargetResult(target, futureResult));
}
public FederationResult build() {
- return new FederationResult(results.build());
+ return new FederationResult(List.copyOf(results));
}
}
diff --git a/container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java b/container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java
index 21b4d1d538f..80a41ffdf22 100644
--- a/container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java
+++ b/container-search/src/main/java/com/yahoo/search/federation/FederationSearcher.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.federation;
-import com.google.common.collect.ImmutableList;
import com.yahoo.component.annotation.Inject;
import com.yahoo.collections.Pair;
import com.yahoo.component.ComponentId;
@@ -10,7 +9,6 @@ import com.yahoo.component.chain.Chain;
import com.yahoo.component.chain.dependencies.After;
import com.yahoo.component.chain.dependencies.Provides;
import com.yahoo.component.provider.ComponentRegistry;
-import com.yahoo.concurrent.CopyOnWriteHashMap;
import com.yahoo.errorhandling.Results;
import com.yahoo.errorhandling.Results.Builder;
import com.yahoo.prelude.IndexFacts;
@@ -28,7 +26,6 @@ import com.yahoo.search.federation.sourceref.SourceRefResolver;
import com.yahoo.search.federation.sourceref.SourcesTarget;
import com.yahoo.search.federation.sourceref.UnresolvedSearchChainException;
import com.yahoo.search.query.Properties;
-import com.yahoo.search.query.properties.SubProperties;
import com.yahoo.search.result.ErrorMessage;
import com.yahoo.search.result.Hit;
import com.yahoo.search.result.HitGroup;
@@ -77,11 +74,9 @@ public class FederationSearcher extends ForkingSearcher {
public final static CompoundName PROVIDERNAME = new CompoundName("providerName");
public static final String FEDERATION = "Federation";
public static final String LOG_COUNT_PREFIX = "count_";
- private static final List<CompoundName> queryAndHits = ImmutableList.of(Query.OFFSET, Query.HITS);
private final SearchChainResolver searchChainResolver;
private final SourceRefResolver sourceRefResolver;
- private final CopyOnWriteHashMap<CompoundKey, CompoundName> map = new CopyOnWriteHashMap<>();
private final TargetSelector<?> targetSelector;
private final Clock clock = Clock.systemUTC();
@@ -338,22 +333,6 @@ public class FederationSearcher extends ForkingSearcher {
return commentedSearchChains;
}
- /**
- * Returns the set of properties set for the source or provider given in the query (if any).
- *
- * If the query has not set sourceName or providerName, null will be returned
- */
- public static Properties getSourceProperties(Query query) {
- String sourceName = query.properties().getString(SOURCENAME);
- String providerName = query.properties().getString(PROVIDERNAME);
- if (sourceName == null || providerName == null)
- return null;
- Properties sourceProperties = new SubProperties("source." + sourceName, query.properties());
- Properties providerProperties = new SubProperties("provider." + providerName, query.properties());
- sourceProperties.chain(providerProperties);
- return sourceProperties;
- }
-
@Override
public void fill(Result result, String summaryClass, Execution execution) {
UniqueExecutionsToResults uniqueExecutionsToResults = new UniqueExecutionsToResults();
@@ -662,9 +641,8 @@ public class FederationSearcher extends ForkingSearcher {
@Override
public boolean equals(Object o) {
if (o == this) return true;
- if ( ! ( o instanceof StandardTarget)) return false;
+ if ( ! (o instanceof StandardTarget other)) return false;
- StandardTarget other = (StandardTarget)o;
if ( ! Objects.equals(other.chain.getId(), this.chain.getId())) return false;
if ( ! Objects.equals(other.target, this.target)) return false;
return true;
diff --git a/container-search/src/main/java/com/yahoo/search/federation/sourceref/SearchChainInvocationSpec.java b/container-search/src/main/java/com/yahoo/search/federation/sourceref/SearchChainInvocationSpec.java
index 34eeb3ce82c..f432289d2c1 100644
--- a/container-search/src/main/java/com/yahoo/search/federation/sourceref/SearchChainInvocationSpec.java
+++ b/container-search/src/main/java/com/yahoo/search/federation/sourceref/SearchChainInvocationSpec.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.federation.sourceref;
-import com.google.common.collect.ImmutableList;
import com.yahoo.component.ComponentId;
import com.yahoo.search.searchchain.model.federation.FederationOptions;
@@ -24,7 +23,7 @@ public class SearchChainInvocationSpec implements Cloneable {
public final ComponentId provider;
public final FederationOptions federationOptions;
- public final ImmutableList<String> documentTypes;
+ public final List<String> documentTypes;
SearchChainInvocationSpec(ComponentId searchChainId,
ComponentId source, ComponentId provider, FederationOptions federationOptions,
@@ -33,7 +32,7 @@ public class SearchChainInvocationSpec implements Cloneable {
this.source = source;
this.provider = provider;
this.federationOptions = federationOptions;
- this.documentTypes = ImmutableList.copyOf(documentTypes);
+ this.documentTypes = List.copyOf(documentTypes);
}
@Override
@@ -44,9 +43,8 @@ public class SearchChainInvocationSpec implements Cloneable {
@Override
public boolean equals(Object o) {
if (o == this) return true;
- if ( ! ( o instanceof SearchChainInvocationSpec)) return false;
+ if ( ! (o instanceof SearchChainInvocationSpec other)) return false;
- SearchChainInvocationSpec other = (SearchChainInvocationSpec)o;
if ( ! Objects.equals(this.searchChainId, other.searchChainId)) return false;
if ( ! Objects.equals(this.source, other.source)) return false;
if ( ! Objects.equals(this.provider, other.provider)) return false;