summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java3
-rwxr-xr-xconfig-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java9
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModel.java3
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/component/ConfigProducerGroup.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/component/SimpleComponent.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/component/chain/Chain.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java44
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/DispatcherComponent.java37
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/GenericTarget.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/LocalProvider.java15
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/SearchChains.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleMapper.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java92
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java88
15 files changed, 165 insertions, 141 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
index 922c6488659..0bdc3fbef9a 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
@@ -46,8 +46,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
RankProfilesConfig.Producer,
RankingConstantsConfig.Producer,
ServletPathsConfig.Producer,
- ContainerMbusConfig.Producer
-{
+ ContainerMbusConfig.Producer {
private final Set<FileReference> applicationBundles = new LinkedHashSet<>();
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
index e4f5791b6b3..f5eb128e7f3 100755
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
@@ -99,9 +99,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
DocprocConfig.Producer,
ClusterInfoConfig.Producer,
RoutingProviderConfig.Producer,
- ConfigserverConfig.Producer
-
-{
+ ConfigserverConfig.Producer {
/**
* URI prefix used for internal, usually programmatic, APIs. URIs using this
@@ -268,6 +266,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
*
* @return the removed component, or null if it was not present
*/
+ @SuppressWarnings("unused") // Used from other repositories
public Component removeComponent(ComponentId componentId) {
return componentGroup.removeComponent(componentId);
}
@@ -298,7 +297,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
public void addContainer(CONTAINER container) {
container.setClusterName(name);
container.setProp("clustername", name)
- .setProp("index", this.containers.size());
+ .setProp("index", this.containers.size());
containers.add(container);
}
@@ -330,7 +329,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
public SearchChains getSearchChains() {
if (containerSearch == null)
throw new IllegalStateException("Search components not found in container cluster '" + getSubId() +
- "': Add <search/> to the cluster in services.xml");
+ "': Add <search/> to the cluster in services.xml");
return containerSearch.getChains();
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModel.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModel.java
index f02878fe545..67870dc049d 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModel.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModel.java
@@ -48,9 +48,8 @@ public class ContainerModel extends ConfigModel {
List<AbstractSearchCluster> searchClusters = Content.getSearchClusters(configModelRepo);
Map<String, AbstractSearchCluster> searchClustersByName = new TreeMap<>();
- for (AbstractSearchCluster c : searchClusters) {
+ for (AbstractSearchCluster c : searchClusters)
searchClustersByName.put(c.getClusterName(), c);
- }
getCluster().initialize(searchClustersByName);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/ConfigProducerGroup.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/ConfigProducerGroup.java
index 66294d3fcef..c671749cff0 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/component/ConfigProducerGroup.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/ConfigProducerGroup.java
@@ -55,9 +55,7 @@ public class ConfigProducerGroup<CHILD extends AbstractConfigProducer<?>> extend
return Collections.unmodifiableCollection(result);
}
- /**
- * @return A map of all components in this group, with (local) component ID as key.
- */
+ /** Returns a map of all components in this group, with (local) component ID as key. */
public Map<ComponentId, CHILD> getComponentMap() {
return Collections.unmodifiableMap(producerById);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java
index 62aae85b55a..e07c3216850 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/Handler.java
@@ -11,17 +11,13 @@ import java.util.Collections;
import java.util.List;
/**
- * <p>
* Models a jdisc RequestHandler (including ClientProvider).
* RequestHandlers always have at least one server binding,
* while ClientProviders have at least one client binding.
- * </p>
* <p>
* Note that this is also used to model vespa handlers (which do not have any bindings)
- * </p>
*
* @author gjoranv
- * @since 5.1.6
*/
public class Handler<CHILD extends AbstractConfigProducer<?>> extends Component<CHILD, ComponentModel> {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/SimpleComponent.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/SimpleComponent.java
index c4e988e6749..46ee0d0bd37 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/component/SimpleComponent.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/SimpleComponent.java
@@ -9,7 +9,6 @@ import com.yahoo.config.model.producer.AbstractConfigProducer;
* A component that only needs a simple ComponentModel.
*
* @author gjoranv
- * @since 5.1.9
*/
public class SimpleComponent extends Component<AbstractConfigProducer<?>, ComponentModel> {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/chain/Chain.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/chain/Chain.java
index 6b4f8c8f8b5..97a09aa48d8 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/component/chain/Chain.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/chain/Chain.java
@@ -26,7 +26,6 @@ public class Chain<T extends ChainedComponent<?>> extends AbstractConfigProducer
private final ComponentGroup<T> innerComponentsGroup;
private static final Type.Enum TYPE = Type.SEARCH;
-
public Chain(ChainSpecification specWithoutInnerComponents) {
super(specWithoutInnerComponents.componentId.stringValue());
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 5266fc46f6e..e19d81e7fb2 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
@@ -15,6 +15,7 @@ import com.yahoo.vespa.model.search.AbstractSearchCluster;
import com.yahoo.vespa.model.search.IndexedSearchCluster;
import com.yahoo.vespa.model.search.StreamingSearchCluster;
+import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
@@ -33,7 +34,8 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains>
SemanticRulesConfig.Producer,
PageTemplatesConfig.Producer {
- private final List<AbstractSearchCluster> systems = new LinkedList<>();
+ private ApplicationContainerCluster owningCluster;
+ private final List<AbstractSearchCluster> searchClusters = new LinkedList<>();
private final Options options;
private QueryProfiles queryProfiles;
@@ -42,26 +44,36 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains>
public ContainerSearch(ApplicationContainerCluster cluster, SearchChains chains, Options options) {
super(chains);
+ this.owningCluster = cluster;
this.options = options;
}
public void connectSearchClusters(Map<String, AbstractSearchCluster> searchClusters) {
- systems.addAll(searchClusters.values());
+ this.searchClusters.addAll(searchClusters.values());
+ initializeDispatchers(searchClusters.values());
initializeSearchChains(searchClusters);
}
+ /** Adds a Dispatcher component to the owning container cluster for each search cluster */
+ private void initializeDispatchers(Collection<AbstractSearchCluster> searchClusters) {
+ for (AbstractSearchCluster searchCluster : searchClusters) {
+ if ( ! ( searchCluster instanceof IndexedSearchCluster)) continue;
+ owningCluster.addComponent(new DispatcherComponent((IndexedSearchCluster)searchCluster));
+ }
+ }
+
// public for testing
public void initializeSearchChains(Map<String, ? extends AbstractSearchCluster> searchClusters) {
getChains().initialize(searchClusters);
QrsCache defaultCacheOptions = getOptions().cacheSettings.get("");
if (defaultCacheOptions != null) {
- for (LocalProvider localProvider: getChains().localProviders()) {
+ for (LocalProvider localProvider : getChains().localProviders()) {
localProvider.setCacheSize(defaultCacheOptions.size);
}
}
- for (LocalProvider localProvider: getChains().localProviders()) {
+ for (LocalProvider localProvider : getChains().localProviders()) {
QrsCache cacheOptions = getOptions().cacheSettings.get(localProvider.getClusterName());
if (cacheOptions != null) {
localProvider.setCacheSize(cacheOptions.size);
@@ -83,39 +95,39 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains>
@Override
public void getConfig(QueryProfilesConfig.Builder builder) {
- if (queryProfiles!=null) {
+ if (queryProfiles != null) {
queryProfiles.getConfig(builder);
}
}
@Override
public void getConfig(SemanticRulesConfig.Builder builder) {
- if (semanticRules!=null) semanticRules.getConfig(builder);
+ if (semanticRules != null) semanticRules.getConfig(builder);
}
@Override
public void getConfig(PageTemplatesConfig.Builder builder) {
- if (pageTemplates!=null) pageTemplates.getConfig(builder);
+ if (pageTemplates != null) pageTemplates.getConfig(builder);
}
@Override
public void getConfig(IndexInfoConfig.Builder builder) {
- for (AbstractSearchCluster sc : systems) {
+ for (AbstractSearchCluster sc : searchClusters) {
sc.getConfig(builder);
}
}
@Override
public void getConfig(IlscriptsConfig.Builder builder) {
- for (AbstractSearchCluster sc : systems) {
+ for (AbstractSearchCluster sc : searchClusters) {
sc.getConfig(builder);
}
}
@Override
public void getConfig(QrSearchersConfig.Builder builder) {
- for (int i = 0; i < systems.size(); i++) {
- AbstractSearchCluster sys = findClusterWithId(systems, i);
+ for (int i = 0; i < searchClusters.size(); i++) {
+ AbstractSearchCluster sys = findClusterWithId(searchClusters, i);
QrSearchersConfig.Searchcluster.Builder scB = new QrSearchersConfig.Searchcluster.Builder().
name(sys.getClusterName());
for (AbstractSearchCluster.SearchDefinitionSpec spec : sys.getLocalSDS()) {
@@ -133,9 +145,8 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains>
private static AbstractSearchCluster findClusterWithId(List<AbstractSearchCluster> clusters, int index) {
for (AbstractSearchCluster sys : clusters) {
- if (sys.getClusterIndex() == index) {
+ if (sys.getClusterIndex() == index)
return sys;
- }
}
throw new IllegalArgumentException("No search cluster with index " + index + " exists");
}
@@ -144,10 +155,11 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains>
return options;
}
- /**
- * Struct that encapsulates qrserver options.
- */
+ /** Encapsulates qrserver options. */
public static class Options {
+
Map<String, QrsCache> cacheSettings = new LinkedHashMap<>();
+
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/DispatcherComponent.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/DispatcherComponent.java
new file mode 100644
index 00000000000..7f51efcd092
--- /dev/null
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/DispatcherComponent.java
@@ -0,0 +1,37 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.model.container.search;
+
+import com.yahoo.osgi.provider.model.ComponentModel;
+import com.yahoo.vespa.config.search.DispatchConfig;
+import com.yahoo.vespa.model.container.component.Component;
+import com.yahoo.vespa.model.container.xml.BundleMapper;
+import com.yahoo.vespa.model.search.IndexedSearchCluster;
+
+/**
+ * Represents a dispatcher component - an instance of a dispatcher in a search container cluster
+ * knows how to communicate with one indexed search cluster and owns the connections to it.
+ */
+public class DispatcherComponent extends Component<DispatcherComponent, ComponentModel>
+ implements DispatchConfig.Producer {
+
+ private final IndexedSearchCluster indexedSearchCluster;
+
+ public DispatcherComponent(IndexedSearchCluster indexedSearchCluster) {
+ super(toComponentModel(indexedSearchCluster));
+ this.indexedSearchCluster = indexedSearchCluster;
+ }
+
+ private static ComponentModel toComponentModel(IndexedSearchCluster indexedSearchCluster) {
+ String dispatcherComponentId = "dispatcher." + indexedSearchCluster.getClusterName(); // used by ClusterSearcher
+ return new ComponentModel(dispatcherComponentId,
+ "com.yahoo.search.dispatch.Dispatcher",
+ BundleMapper.searchAndDocprocBundle,
+ null);
+ }
+
+ @Override
+ public void getConfig(DispatchConfig.Builder builder) {
+ indexedSearchCluster.getConfig(builder);
+ }
+
+}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/GenericTarget.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/GenericTarget.java
index 875de1465c6..660ee2628b8 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/GenericTarget.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/searchchain/GenericTarget.java
@@ -6,6 +6,7 @@ import com.yahoo.search.searchchain.model.federation.FederationOptions;
/**
* A search chain that is intended to be used for federation (i.e. providers, sources)
+ *
* @author Tony Vaagenes
*/
abstract public class GenericTarget extends SearchChain {
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 25a4197dcac..e05b2d27e09 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
@@ -7,14 +7,12 @@ import com.yahoo.component.chain.model.ChainSpecification;
import com.yahoo.component.chain.model.ChainedComponentModel;
import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
import com.yahoo.prelude.cluster.QrMonitorConfig;
-import com.yahoo.vespa.config.search.DispatchConfig;
import com.yahoo.vespa.config.search.RankProfilesConfig;
import com.yahoo.vespa.config.search.AttributesConfig;
import com.yahoo.search.config.ClusterConfig;
import com.yahoo.search.searchchain.model.federation.FederationOptions;
import com.yahoo.search.searchchain.model.federation.LocalProviderSpec;
import com.yahoo.vespa.model.search.AbstractSearchCluster;
-import com.yahoo.vespa.model.search.IndexedSearchCluster;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@@ -31,8 +29,7 @@ public class LocalProvider extends Provider implements
ClusterConfig.Producer,
AttributesConfig.Producer,
QrMonitorConfig.Producer,
- RankProfilesConfig.Producer,
- DispatchConfig.Producer {
+ RankProfilesConfig.Producer {
private final LocalProviderSpec providerSpec;
private volatile AbstractSearchCluster searchCluster;
@@ -106,7 +103,6 @@ public class LocalProvider extends Provider implements
}
void setSearchCluster(AbstractSearchCluster searchCluster) {
- assert (this.searchCluster == null);
this.searchCluster = searchCluster;
}
@@ -160,13 +156,4 @@ public class LocalProvider extends Provider implements
return (visibilityDelay < 1.0d) ? 0.0d : visibilityDelay;
}
- @Override
- public void getConfig(DispatchConfig.Builder builder) {
- if (!(searchCluster instanceof IndexedSearchCluster)) {
- log.warning("Could not build DispatchConfig: Only supported for IndexedSearchCluster, got "
- + searchCluster.getClass().getCanonicalName());
- return;
- }
- ((IndexedSearchCluster) searchCluster).getConfig(builder);
- }
}
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 24ff885f131..1520dffb695 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
@@ -29,7 +29,7 @@ public class SearchChains extends Chains<SearchChain> {
LocalClustersCreator.addDefaultLocalProviders(this, searchClustersByName.keySet());
VespaSearchChainsCreator.addVespaSearchChains(this);
- validateSourceGroups(); //must be done before initializing searchers since they are used by FederationSearchers.
+ validateSourceGroups(); //must be done before initializing searchers since they are used by FederationSearchers
initializeComponents(searchClustersByName);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleMapper.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleMapper.java
index d8e678a5cd3..aa7cb5eb539 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleMapper.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleMapper.java
@@ -28,7 +28,6 @@ public class BundleMapper {
public static final Path LIBRARY_PATH = Paths.get(Defaults.getDefaults().underVespaHome("lib/jars"));
-
public static final String searchAndDocprocBundle = "container-search-and-docproc";
private static final Map<String, String> bundleFromClass;
@@ -111,7 +110,6 @@ public class BundleMapper {
bundleFromClass.put("com.yahoo.search.pagetemplates.engine.resolvers.DeterministicResolver", searchAndDocprocBundle);
bundleFromClass.put("com.yahoo.search.pagetemplates.engine.resolvers.RandomResolver", searchAndDocprocBundle);
bundleFromClass.put("com.yahoo.search.pagetemplates.model.Renderer", searchAndDocprocBundle);
- bundleFromClass.put("com.yahoo.search.pagetemplates.model.Renderer", searchAndDocprocBundle);
bundleFromClass.put("com.yahoo.search.query.rewrite.QueryRewriteSearcher", searchAndDocprocBundle);
bundleFromClass.put("com.yahoo.search.query.rewrite.SearchChainDispatcherSearcher", searchAndDocprocBundle);
bundleFromClass.put("com.yahoo.search.query.rewrite.rewriters.GenericExpansionRewriter", searchAndDocprocBundle);
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
index fbbf029d5f1..85663a59556 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
@@ -29,51 +29,7 @@ public abstract class AbstractSearchCluster extends AbstractConfigProducer
protected int index;
private Double visibilityDelay = 0.0;
private List<String> documentNames = new ArrayList<>();
-
- protected List<SearchDefinitionSpec> localSDS = new LinkedList<>();
-
- public void prepareToDistributeFiles(List<SearchNode> backends) {
- for (SearchDefinitionSpec sds : localSDS)
- sds.getSearchDefinition().getSearch().rankingConstants().sendTo(backends);
- }
-
- public static final class IndexingMode {
-
- public static final IndexingMode REALTIME = new IndexingMode("REALTIME");
- public static final IndexingMode STREAMING = new IndexingMode("STREAMING");
-
- private final String name;
-
- private IndexingMode(String name) {
- this.name = name;
- }
-
- public String getName() { return name; }
-
- public String toString() {
- return "indexingmode: " + name;
- }
- }
-
- public static final class SearchDefinitionSpec {
-
- private final SearchDefinition searchDefinition;
- private final UserConfigRepo userConfigRepo;
-
- public SearchDefinitionSpec(SearchDefinition searchDefinition,
- UserConfigRepo userConfigRepo) {
- this.searchDefinition = searchDefinition;
- this.userConfigRepo = userConfigRepo;
- }
-
- public SearchDefinition getSearchDefinition() {
- return searchDefinition;
- }
-
- public UserConfigRepo getUserConfigs() {
- return userConfigRepo;
- }
- }
+ private List<SearchDefinitionSpec> localSDS = new LinkedList<>();
public AbstractSearchCluster(AbstractConfigProducer parent, String clusterName, int index) {
super(parent, "cluster." + clusterName);
@@ -81,6 +37,11 @@ public abstract class AbstractSearchCluster extends AbstractConfigProducer
this.index = index;
}
+ public void prepareToDistributeFiles(List<SearchNode> backends) {
+ for (SearchDefinitionSpec sds : localSDS)
+ sds.getSearchDefinition().getSearch().rankingConstants().sendTo(backends);
+ }
+
public void addDocumentNames(SearchDefinition searchDefinition) {
String dName = searchDefinition.getSearch().getDocument().getDocumentName().getName();
documentNames.add(dName);
@@ -97,14 +58,17 @@ public abstract class AbstractSearchCluster extends AbstractConfigProducer
public final String getIndexingModeName() { return getIndexingMode().getName(); }
public final boolean isRealtime() { return getIndexingMode() == IndexingMode.REALTIME; }
public final boolean isStreaming() { return getIndexingMode() == IndexingMode.STREAMING; }
+
public final AbstractSearchCluster setQueryTimeout(Double to) {
this.queryTimeout=to;
return this;
}
+
public final AbstractSearchCluster setVisibilityDelay(double delay) {
this.visibilityDelay=delay;
return this;
}
+
protected abstract IndexingMode getIndexingMode();
public final Double getVisibilityDelay() { return visibilityDelay; }
public final Double getQueryTimeout() { return queryTimeout; }
@@ -122,4 +86,42 @@ public abstract class AbstractSearchCluster extends AbstractConfigProducer
public abstract void getConfig(RankProfilesConfig.Builder builder);
public abstract void getConfig(AttributesConfig.Builder builder);
+ public static final class IndexingMode {
+
+ public static final IndexingMode REALTIME = new IndexingMode("REALTIME");
+ public static final IndexingMode STREAMING = new IndexingMode("STREAMING");
+
+ private final String name;
+
+ private IndexingMode(String name) {
+ this.name = name;
+ }
+
+ public String getName() { return name; }
+
+ public String toString() {
+ return "indexingmode: " + name;
+ }
+ }
+
+ public static final class SearchDefinitionSpec {
+
+ private final SearchDefinition searchDefinition;
+ private final UserConfigRepo userConfigRepo;
+
+ public SearchDefinitionSpec(SearchDefinition searchDefinition,
+ UserConfigRepo userConfigRepo) {
+ this.searchDefinition = searchDefinition;
+ this.userConfigRepo = userConfigRepo;
+ }
+
+ public SearchDefinition getSearchDefinition() {
+ return searchDefinition;
+ }
+
+ public UserConfigRepo getUserConfigs() {
+ return userConfigRepo;
+ }
+ }
+
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java
index 7d03a7acee7..64ac00020f7 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java
@@ -30,53 +30,9 @@ import java.util.List;
public class IndexedSearchCluster extends SearchCluster
implements
DocumentdbInfoConfig.Producer,
- // TODO consider removing, these only produced by UnionConfiguration and DocumentDatabase?
IndexInfoConfig.Producer,
IlscriptsConfig.Producer,
- DispatchConfig.Producer
-{
-
- /**
- * Class used to retrieve combined configuration from multiple document databases.
- * It is not a {@link com.yahoo.config.ConfigInstance.Producer} of those configs,
- * that is handled (by delegating to this) by the {@link IndexedSearchCluster}
- * which is the parent to this. This avoids building the config multiple times.
- */
- public static class UnionConfiguration
- extends AbstractConfigProducer
- implements AttributesConfig.Producer {
- private final List<DocumentDatabase> docDbs;
-
- public void getConfig(IndexInfoConfig.Builder builder) {
- for (DocumentDatabase docDb : docDbs) {
- docDb.getConfig(builder);
- }
- }
-
- public void getConfig(IlscriptsConfig.Builder builder) {
- for (DocumentDatabase docDb : docDbs) {
- docDb.getConfig(builder);
- }
- }
-
- @Override
- public void getConfig(AttributesConfig.Builder builder) {
- for (DocumentDatabase docDb : docDbs) {
- docDb.getConfig(builder);
- }
- }
-
- public void getConfig(RankProfilesConfig.Builder builder) {
- for (DocumentDatabase docDb : docDbs) {
- docDb.getConfig(builder);
- }
- }
-
- private UnionConfiguration(AbstractConfigProducer parent, List<DocumentDatabase> docDbs) {
- super(parent, "union");
- this.docDbs = docDbs;
- }
- }
+ DispatchConfig.Producer {
private String indexingClusterName = null; // The name of the docproc cluster to run indexing, by config.
private String indexingChainName = null;
@@ -387,4 +343,46 @@ public class IndexedSearchCluster extends SearchCluster
@Override
public int getRowBits() { return 8; }
+ /**
+ * Class used to retrieve combined configuration from multiple document databases.
+ * It is not a {@link com.yahoo.config.ConfigInstance.Producer} of those configs,
+ * that is handled (by delegating to this) by the {@link IndexedSearchCluster}
+ * which is the parent to this. This avoids building the config multiple times.
+ */
+ public static class UnionConfiguration
+ extends AbstractConfigProducer
+ implements AttributesConfig.Producer {
+ private final List<DocumentDatabase> docDbs;
+
+ public void getConfig(IndexInfoConfig.Builder builder) {
+ for (DocumentDatabase docDb : docDbs) {
+ docDb.getConfig(builder);
+ }
+ }
+
+ public void getConfig(IlscriptsConfig.Builder builder) {
+ for (DocumentDatabase docDb : docDbs) {
+ docDb.getConfig(builder);
+ }
+ }
+
+ @Override
+ public void getConfig(AttributesConfig.Builder builder) {
+ for (DocumentDatabase docDb : docDbs) {
+ docDb.getConfig(builder);
+ }
+ }
+
+ public void getConfig(RankProfilesConfig.Builder builder) {
+ for (DocumentDatabase docDb : docDbs) {
+ docDb.getConfig(builder);
+ }
+ }
+
+ private UnionConfiguration(AbstractConfigProducer parent, List<DocumentDatabase> docDbs) {
+ super(parent, "union");
+ this.docDbs = docDbs;
+ }
+ }
+
}