aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/dispatch/InvokerFactory.java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-11-22 22:16:42 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2022-11-23 10:01:17 +0100
commitef637d4a7236d6570c748ba5782e0435f628bd9a (patch)
treed7c4a7ab240d2faca50eace28eb18db2cda5240c /container-search/src/main/java/com/yahoo/search/dispatch/InvokerFactory.java
parentb8165e0e316527dc956489bc416f9ccb83cf1904 (diff)
Make a few simpler interfaces instead of carrying one huge implement all SearchCluster around.
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/dispatch/InvokerFactory.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/InvokerFactory.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/InvokerFactory.java b/container-search/src/main/java/com/yahoo/search/dispatch/InvokerFactory.java
index 02cf11c9fe7..caeae9c2c1d 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/InvokerFactory.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/InvokerFactory.java
@@ -10,6 +10,7 @@ import com.yahoo.search.dispatch.searchcluster.Node;
import com.yahoo.search.dispatch.searchcluster.SearchCluster;
import com.yahoo.search.result.Coverage;
import com.yahoo.search.result.ErrorMessage;
+import com.yahoo.vespa.config.search.DispatchConfig;
import java.util.ArrayList;
import java.util.HashSet;
@@ -21,11 +22,16 @@ import java.util.Set;
* @author ollivir
*/
public abstract class InvokerFactory {
+ private static final double SKEW_FACTOR = 0.05;
- protected final SearchCluster searchCluster;
+ private final SearchCluster searchCluster;
+ private final DispatchConfig dispatchConfig;
+ private final TopKEstimator hitEstimator;
- public InvokerFactory(SearchCluster searchCluster) {
+ public InvokerFactory(SearchCluster searchCluster, DispatchConfig dispatchConfig) {
this.searchCluster = searchCluster;
+ this.dispatchConfig = dispatchConfig;
+ this.hitEstimator = new TopKEstimator(30.0, dispatchConfig.topKProbability(), SKEW_FACTOR);
}
protected abstract Optional<SearchInvoker> createNodeSearchInvoker(VespaBackEndSearcher searcher,
@@ -90,7 +96,7 @@ public abstract class InvokerFactory {
if (invokers.size() == 1 && failed == null) {
return Optional.of(invokers.get(0));
} else {
- return Optional.of(new InterleavedSearchInvoker(Timer.monotonic, invokers, searchCluster, group, failed));
+ return Optional.of(new InterleavedSearchInvoker(Timer.monotonic, invokers, hitEstimator, dispatchConfig, group, failed));
}
}