Search in sources :

Example 26 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class TypeConversionTestCase method testExactStringToStringTypeConversion.

/**
 * Tests that exact-string stuff is not spilled over to the default index
 */
@Test
public void testExactStringToStringTypeConversion() {
    Search search = new Search("test", null);
    RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search);
    SDDocumentType document = new SDDocumentType("test");
    search.addDocument(document);
    SDField a = new SDField("a", DataType.STRING);
    a.parseIndexingScript("{ index }");
    document.addField(a);
    Processing.process(search, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(), true);
    DerivedConfiguration derived = new DerivedConfiguration(search, rankProfileRegistry, new QueryProfileRegistry());
    IndexInfo indexInfo = derived.getIndexInfo();
    assertFalse(indexInfo.hasCommand("default", "compact-to-term"));
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 27 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class ApplicationPreprocessor method run.

public void run() throws IOException, TransformerException, ParserConfigurationException, SAXException {
    DeployLogger logger = new BaseDeployLogger();
    FilesApplicationPackage.Builder applicationPackageBuilder = new FilesApplicationPackage.Builder(applicationDir);
    outputDir.ifPresent(applicationPackageBuilder::preprocessedDir);
    ApplicationPackage preprocessed = applicationPackageBuilder.build().preprocess(new Zone(environment.orElse(Environment.defaultEnvironment()), region.orElse(RegionName.defaultName())), logger);
    preprocessed.validateXML();
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) DeployLogger(com.yahoo.config.application.api.DeployLogger) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage)

Example 28 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class RankPropertyVariablesTestCase method testRankPropVariables.

@Test
public void testRankPropVariables() throws IOException, ParseException {
    RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
    Search search = SearchBuilder.buildFromFile("src/test/examples/rankpropvars.sd", new BaseDeployLogger(), rankProfileRegistry, new QueryProfileRegistry());
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "other").getRankProperties(), "$testvar1", "foo");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "other").getRankProperties(), "$testvar_2", "bar");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "other").getRankProperties(), "$testvarOne23", "baz");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "another").getRankProperties(), "$Testvar1", "1");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "another").getRankProperties(), "$Testvar_4", "4");
    assertRankPropEquals(rankProfileRegistry.getRankProfile(search, "another").getRankProperties(), "$testvarFour23", "234234.234");
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 29 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class SummaryMapTestCase method testDeriving.

@Test
public void testDeriving() throws IOException, ParseException {
    Search search = SearchBuilder.buildFromFile("src/test/examples/simple.sd");
    SummaryMap summaryMap = new SummaryMap(search, new Summaries(search, new BaseDeployLogger()));
    Iterator transforms = summaryMap.resultTransformIterator();
    FieldResultTransform transform = (FieldResultTransform) transforms.next();
    assertEquals("dyndesc", transform.getFieldName());
    assertEquals(SummaryTransform.DYNAMICTEASER, transform.getTransform());
    transform = (FieldResultTransform) transforms.next();
    assertEquals("dynlong", transform.getFieldName());
    assertEquals(SummaryTransform.DYNAMICTEASER, transform.getTransform());
    transform = (FieldResultTransform) transforms.next();
    assertEquals("dyndesc2", transform.getFieldName());
    assertEquals(SummaryTransform.DYNAMICTEASER, transform.getTransform());
    transform = (FieldResultTransform) transforms.next();
    assertEquals("measurement", transform.getFieldName());
    assertEquals(SummaryTransform.ATTRIBUTE, transform.getTransform());
    transform = (FieldResultTransform) transforms.next();
    assertEquals("rankfeatures", transform.getFieldName());
    assertEquals(SummaryTransform.RANKFEATURES, transform.getTransform());
    transform = (FieldResultTransform) transforms.next();
    assertEquals("summaryfeatures", transform.getFieldName());
    assertEquals(SummaryTransform.SUMMARYFEATURES, transform.getTransform());
    transform = (FieldResultTransform) transforms.next();
    assertEquals("popsiness", transform.getFieldName());
    assertEquals(SummaryTransform.ATTRIBUTE, transform.getTransform());
    transform = (FieldResultTransform) transforms.next();
    assertEquals("popularity", transform.getFieldName());
    assertEquals(SummaryTransform.ATTRIBUTE, transform.getTransform());
    transform = (FieldResultTransform) transforms.next();
    assertEquals("access", transform.getFieldName());
    assertEquals(SummaryTransform.ATTRIBUTE, transform.getTransform());
    assertTrue(!transforms.hasNext());
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Iterator(java.util.Iterator) Test(org.junit.Test)

Example 30 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class AttributePropertiesTestCase method testInvalidAttributeProperties.

@Test
public void testInvalidAttributeProperties() throws IOException, ParseException {
    try {
        Search search = UnprocessingSearchBuilder.buildUnprocessedFromFile("src/test/examples/attributeproperties1.sd");
        new AttributeProperties(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true);
        fail("attribute property should not be set");
    } catch (RuntimeException e) {
    // empty
    }
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) Test(org.junit.Test)

Aggregations

BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)39 Test (org.junit.Test)30 Search (com.yahoo.searchdefinition.Search)12 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)12 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)10 FileNode (com.yahoo.config.FileNode)8 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)7 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)6 SDField (com.yahoo.searchdefinition.document.SDField)6 UserConfigRepo (com.yahoo.config.model.producer.UserConfigRepo)4 ConfigDefinitionKey (com.yahoo.vespa.config.ConfigDefinitionKey)4 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)3 File (java.io.File)3 Iterator (java.util.Iterator)3 Element (org.w3c.dom.Element)3 Version (com.yahoo.component.Version)2 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)2 DeployLogger (com.yahoo.config.application.api.DeployLogger)2 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)2 RankProfile (com.yahoo.searchdefinition.RankProfile)2