blob: dd0dbc744e1ccc3cee0fa7c2e2d628419f7b8aa0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.application.validation;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.document.select.DocumentSelector;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.search.SearchCluster;
import com.yahoo.vespa.model.search.IndexedSearchCluster;
/**
* Validates routing selector for search and content clusters
*/
public class RoutingSelectorValidator extends Validator {
@Override
public void validate(VespaModel model, DeployState deployState) {
for (SearchCluster cluster : model.getSearchClusters()) {
if (cluster instanceof IndexedSearchCluster) {
IndexedSearchCluster sc = (IndexedSearchCluster) cluster;
String routingSelector = sc.getRoutingSelector();
if (routingSelector == null) continue;
try {
new DocumentSelector(routingSelector);
} catch (com.yahoo.document.select.parser.ParseException e) {
throw new IllegalArgumentException("Failed to parse routing selector for search cluster '" +
sc.getClusterName() + "'", e);
}
}
}
}
}
|