Search in sources :

Example 1 with DomSearchChainsBuilder

use of com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder in project vespa by vespa-engine.

the class ContainerModelBuilder method buildSearch.

private ContainerSearch buildSearch(ContainerCluster containerCluster, Element producerSpec, QueryProfiles queryProfiles, SemanticRules semanticRules) {
    SearchChains searchChains = new DomSearchChainsBuilder(null, false).build(containerCluster, producerSpec);
    ContainerSearch containerSearch = new ContainerSearch(containerCluster, searchChains, new ContainerSearch.Options());
    applyApplicationPackageDirectoryConfigs(containerCluster.getRoot().getDeployState().getApplicationPackage(), containerSearch);
    containerSearch.setQueryProfiles(queryProfiles);
    containerSearch.setSemanticRules(semanticRules);
    return containerSearch;
}
Also used : SearchChains(com.yahoo.vespa.model.container.search.searchchain.SearchChains) DomSearchChainsBuilder(com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder) ContainerSearch(com.yahoo.vespa.model.container.search.ContainerSearch)

Example 2 with DomSearchChainsBuilder

use of com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder in project vespa by vespa-engine.

the class SearchChainsTestBase method setupSearchChains.

@Before
public void setupSearchChains() {
    SearchChains searchChains = new DomSearchChainsBuilder().build(root, servicesXml());
    searchChains.initialize(MockSearchClusters.twoMockClusterSpecsByName(root), new BinaryScaledAmount(100, BinaryPrefix.mega));
    root.freezeModelTopology();
}
Also used : DomSearchChainsBuilder(com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder) BinaryScaledAmount(com.yahoo.binaryprefix.BinaryScaledAmount) Before(org.junit.Before)

Example 3 with DomSearchChainsBuilder

use of com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder in project vespa by vespa-engine.

the class SearchChainsTest2 method fail_upon_unresolved_inheritance.

@Test
public void fail_upon_unresolved_inheritance() {
    final Element searchElem = DomBuilderTest.parse("<search>", "  <chain id='default' inherits='nonexistent' />", "</search>");
    try {
        SearchChains chains = new DomSearchChainsBuilder().build(new MockRoot(), searchElem);
        chains.validate();
        fail("Expected exception when inheriting a nonexistent search chain.");
    } catch (Exception e) {
        assertThat(e.getMessage(), containsString("Missing chain 'nonexistent'"));
    }
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) DomSearchChainsBuilder(com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder) Element(org.w3c.dom.Element) ContainerModelBuilderTest(com.yahoo.vespa.model.container.xml.ContainerModelBuilderTest) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Aggregations

DomSearchChainsBuilder (com.yahoo.vespa.model.builder.xml.dom.chains.search.DomSearchChainsBuilder)3 BinaryScaledAmount (com.yahoo.binaryprefix.BinaryScaledAmount)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 MockRoot (com.yahoo.config.model.test.MockRoot)1 ContainerSearch (com.yahoo.vespa.model.container.search.ContainerSearch)1 SearchChains (com.yahoo.vespa.model.container.search.searchchain.SearchChains)1 ContainerModelBuilderTest (com.yahoo.vespa.model.container.xml.ContainerModelBuilderTest)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Element (org.w3c.dom.Element)1