diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-03-07 15:17:13 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-03-07 15:55:27 +0100 |
commit | a81af2ebddb5fec15f089f63109188ebab98cb6c (patch) | |
tree | c0791ef78d25fd67df3eba5ef80a8bfcf96a305d /config-model/src/main/java/com/yahoo | |
parent | 17bc2824d457eccde682d89c67fc0ce3f12d7dad (diff) |
Only setup `RankProfilesEvaluator` for schemas with 'global-phase'
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java index b2a38bd6b08..870ed6fbf84 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java @@ -46,6 +46,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> private final ApplicationContainerCluster owningCluster; private final List<SearchCluster> searchClusters = new LinkedList<>(); + private final Collection<String> schemasWithGlobalPhase; private final boolean globalPhase; private QueryProfiles queryProfiles; @@ -55,6 +56,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> public ContainerSearch(DeployState deployState, ApplicationContainerCluster cluster, SearchChains chains) { super(chains); this.globalPhase = deployState.featureFlags().enableGlobalPhase(); + this.schemasWithGlobalPhase = getSchemasWithGlobalPhase(deployState); this.owningCluster = cluster; owningCluster.addComponent(Component.fromClassAndBundle(CompiledQueryProfileRegistry.class, SEARCH_AND_DOCPROC_BUNDLE)); @@ -65,6 +67,11 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> cluster.addSearchAndDocprocBundles(); } + private static Collection<String> getSchemasWithGlobalPhase(DeployState state) { + return state.rankProfileRegistry().all().stream() + .filter(rp -> rp.getGlobalPhase() != null).map(rp -> rp.schema().getName()).toList(); + } + public void connectSearchClusters(Map<String, SearchCluster> searchClusters) { this.searchClusters.addAll(searchClusters.values()); initializeDispatchers(searchClusters.values()); @@ -80,6 +87,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> } if (globalPhase) { for (var documentDb : searchCluster.getDocumentDbs()) { + if (!schemasWithGlobalPhase.contains(documentDb.getSchemaName())) continue; var factory = new RankProfilesEvaluatorComponent(documentDb); if (! owningCluster.getComponentsMap().containsKey(factory.getComponentId())) { owningCluster.addComponent(factory); |