use of com.yahoo.searchdefinition.derived.DerivedConfiguration in project vespa by vespa-engine.
the class IndexedSearchCluster method deriveAllSearchDefinitions.
protected void deriveAllSearchDefinitions(List<SearchDefinitionSpec> localSearches, List<com.yahoo.searchdefinition.Search> globalSearches) {
for (SearchDefinitionSpec spec : localSearches) {
com.yahoo.searchdefinition.Search search = spec.getSearchDefinition().getSearch();
if (!(search instanceof UnproperSearch)) {
DocumentDatabase db = new DocumentDatabase(this, search.getName(), new DerivedConfiguration(search, globalSearches, deployLogger(), getRoot().getDeployState().rankProfileRegistry(), getRoot().getDeployState().getQueryProfiles().getRegistry()));
// TODO: remove explicit adding of user configs when the complete content model is built using builders.
db.mergeUserConfigs(spec.getUserConfigs());
documentDbs.add(db);
}
}
}
use of com.yahoo.searchdefinition.derived.DerivedConfiguration in project vespa by vespa-engine.
the class RankingExpressionValidationTestCase method assertFailsExpression.
private void assertFailsExpression(String expression) throws ParseException {
try {
RankProfileRegistry registry = new RankProfileRegistry();
Search search = importWithExpression(expression, registry);
// cause rank profile parsing
new DerivedConfiguration(search, registry, new QueryProfileRegistry());
fail("No exception on incorrect ranking expression " + expression);
} catch (IllegalArgumentException e) {
// Success
// TODO: Where's the "com.yahoo.searchdefinition.parser.ParseException:" nonsense coming from?
assertTrue("Got unexpected error message: " + e.getCause().getMessage(), e.getCause().getMessage().startsWith("com.yahoo.searchdefinition.parser.ParseException: Could not parse ranking expression '" + expression + "'"));
}
}
use of com.yahoo.searchdefinition.derived.DerivedConfiguration in project vespa by vespa-engine.
the class RankingExpressionsTestCase method testThatIncludingFileInSubdirFails.
@Test(expected = IllegalArgumentException.class)
public void testThatIncludingFileInSubdirFails() throws IOException, ParseException {
RankProfileRegistry registry = new RankProfileRegistry();
Search search = SearchBuilder.createFromDirectory("src/test/examples/rankingexpressioninfile", registry, new QueryProfileRegistry()).getSearch();
// rank profile parsing happens during deriving
new DerivedConfiguration(search, registry, new QueryProfileRegistry());
}
use of com.yahoo.searchdefinition.derived.DerivedConfiguration in project vespa by vespa-engine.
the class IncorrectRankingExpressionFileRefTestCase method testIncorrectRef.
@Test
public void testIncorrectRef() throws IOException, ParseException {
try {
RankProfileRegistry registry = new RankProfileRegistry();
Search search = SearchBuilder.buildFromFile("src/test/examples/incorrectrankingexpressionfileref.sd", registry, new QueryProfileRegistry());
// cause rank profile parsing
new DerivedConfiguration(search, registry, new QueryProfileRegistry());
fail("parsing should have failed");
} catch (IllegalArgumentException e) {
e.printStackTrace();
assertTrue(e.getCause().getMessage().contains("Could not read ranking expression file"));
assertTrue(e.getCause().getMessage().contains("wrongending.expr.expression"));
}
}
use of com.yahoo.searchdefinition.derived.DerivedConfiguration in project vespa by vespa-engine.
the class NoPrefixForIndexes method validate.
@Override
public void validate(VespaModel model, DeployState deployState) {
for (AbstractSearchCluster cluster : model.getSearchClusters()) {
if (cluster instanceof IndexedSearchCluster) {
IndexedSearchCluster sc = (IndexedSearchCluster) cluster;
for (DocumentDatabase docDb : sc.getDocumentDbs()) {
DerivedConfiguration sdConfig = docDb.getDerivedConfiguration();
Search search = sdConfig.getSearch();
for (SDField field : search.allConcreteFields()) {
if (field.doesIndexing()) {
// if (!field.getIndexTo().isEmpty() && !field.getIndexTo().contains(field.getName())) continue;
if (field.getMatching().getAlgorithm().equals(Matching.Algorithm.PREFIX)) {
failField(search, field);
}
for (Map.Entry<String, Index> e : field.getIndices().entrySet()) {
if (e.getValue().isPrefix()) {
failField(search, field);
}
}
}
}
}
}
}
}
Aggregations