diff options
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/container/search')
3 files changed, 13 insertions, 39 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 de9e9ad7a4b..a71d1025ece 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 @@ -5,7 +5,6 @@ import com.yahoo.config.application.api.ApplicationPackage; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.container.QrSearchersConfig; import com.yahoo.prelude.semantics.SemanticRulesConfig; -import com.yahoo.schema.derived.SchemaInfo; import com.yahoo.search.config.IndexInfoConfig; import com.yahoo.search.config.SchemaInfoConfig; import com.yahoo.search.dispatch.Dispatcher; @@ -169,25 +168,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> implements @Override public void getConfig(QrSearchersConfig.Builder builder) { - for (int i = 0; i < searchClusters.size(); i++) { - SearchCluster sys = findClusterWithId(searchClusters, i); - var scB = new QrSearchersConfig.Searchcluster.Builder().name(sys.getClusterName()); - for (SchemaInfo spec : sys.schemas().values()) { - scB.searchdef(spec.fullSchema().getName()); - } - scB.rankprofiles_configid(sys.getConfigId()); - scB.indexingmode(QrSearchersConfig.Searchcluster.Indexingmode.Enum.valueOf(sys.getIndexingModeName())); - scB.storagecluster(new QrSearchersConfig.Searchcluster.Storagecluster.Builder().routespec(sys.getStorageRouteSpec())); - builder.searchcluster(scB); - } - } - - private static SearchCluster findClusterWithId(List<SearchCluster> clusters, int index) { - for (SearchCluster sys : clusters) { - if (sys.getClusterIndex() == index) - return sys; - } - throw new IllegalArgumentException("No search cluster with index " + index + " exists"); + searchClusters.forEach(sc -> builder.searchcluster(sc.getQrSearcherConfig())); } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/LocalProvider.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/LocalProvider.java index da7dfdc7b84..554dacb39e3 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/LocalProvider.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/LocalProvider.java @@ -17,7 +17,6 @@ import com.yahoo.vespa.model.search.SearchCluster; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; -import java.util.Objects; import java.util.Set; /** @@ -38,12 +37,7 @@ public class LocalProvider extends Provider implements @Override public void getConfig(ClusterConfig.Builder builder) { - Objects.requireNonNull(searchCluster, "Null search cluster!"); - builder.clusterId(searchCluster.getClusterIndex()); - builder.clusterName(searchCluster.getClusterName()); - - if (searchCluster.getVisibilityDelay() != null) - builder.cacheTimeout(convertVisibilityDelay(searchCluster.getVisibilityDelay())); + searchCluster.getConfig(builder); } @Override @@ -131,13 +125,4 @@ public class LocalProvider extends Provider implements searchCluster.getConfig(builder); } - // The semantics of visibility delay in search is deactivating caches if the - // delay is less than 1.0, in qrs the cache is deactivated if the delay is 0 - // (or less). 1.0 seems a little arbitrary, so just doing the conversion - // here instead of having two totally independent implementations having to - // follow each other down in the modules. - private static Double convertVisibilityDelay(Double visibilityDelay) { - return (visibilityDelay < 1.0d) ? 0.0d : visibilityDelay; - } - } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java index 3f1de25f71f..3cf887a5928 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java @@ -41,9 +41,17 @@ public class SearchChains extends Chains<SearchChain> { private void setSearchClusterForLocalProvider(Map<String, ? extends SearchCluster> clusterIndexByName) { for (LocalProvider provider : localProviders()) { - SearchCluster cluster = clusterIndexByName.get(provider.getClusterName()); - if (cluster == null) - throw new IllegalArgumentException("No searchable content cluster with id '" + provider.getClusterName() + "'"); + String clusterName = provider.getClusterName(); + SearchCluster cluster = clusterIndexByName.get(clusterName); + if (cluster == null) { + if (clusterName.contains(".")) { // Is there a super cluster ... + String prefix = clusterName.substring(0, clusterName.indexOf('.')); + cluster = clusterIndexByName.get(prefix); + } + if (cluster == null) { + throw new IllegalArgumentException("No searchable content cluster with id '" + provider.getClusterName() + "'"); + } + } provider.setSearchCluster(cluster); } } |