Search in sources :

Example 26 with SearchBuilder

use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.

the class ClusterTest method newSearchDefinition.

private static SearchDefinition newSearchDefinition(String name) throws ParseException {
    SearchBuilder builder = new SearchBuilder();
    builder.importString("search " + name + " { document " + name + " { } }");
    builder.build();
    return new SearchDefinition(name, builder.getSearch(name));
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) SearchDefinition(com.yahoo.vespa.model.search.SearchDefinition)

Example 27 with SearchBuilder

use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.

the class InheritanceTestCase method testInheritance.

@Test
public void testInheritance() throws IOException, ParseException {
    String dir = "src/test/derived/inheritance/";
    SearchBuilder builder = new SearchBuilder();
    builder.importFile(dir + "grandparent.sd");
    builder.importFile(dir + "father.sd");
    builder.importFile(dir + "mother.sd");
    builder.importFile(dir + "child.sd");
    builder.build();
    derive("inheritance", builder, builder.getSearch("child"));
    assertCorrectConfigFiles("inheritance");
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) Test(org.junit.Test)

Example 28 with SearchBuilder

use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.

the class InheritanceTestCase method requireThatStructTypesAreInheritedFromParent.

@Test
public void requireThatStructTypesAreInheritedFromParent() throws IOException, ParseException {
    String dir = "src/test/derived/inheritfromparent/";
    SearchBuilder builder = new SearchBuilder();
    builder.importFile(dir + "parent.sd");
    builder.importFile(dir + "child.sd");
    builder.build();
    derive("inheritfromparent", builder, builder.getSearch("child"));
    assertCorrectConfigFiles("inheritfromparent");
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) Test(org.junit.Test)

Example 29 with SearchBuilder

use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.

the class SummaryTestCase method buildCampaignAdModel.

private static Search buildCampaignAdModel() throws ParseException {
    SearchBuilder builder = new SearchBuilder();
    builder.importString("search campaign { document campaign {} }");
    builder.importString(joinLines("search ad {", "  document ad {", "    field campaign_ref type reference<campaign> {", "      indexing: summary | attribute", "    }", "    field other_campaign_ref type reference<campaign> {", "      indexing: summary | attribute", "    }", "  }", "  document-summary my_summary {", "    summary other_campaign_ref type reference<campaign> {}", "  }", "}"));
    builder.build();
    return builder.getSearch("ad");
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder)

Example 30 with SearchBuilder

use of com.yahoo.searchdefinition.SearchBuilder in project vespa by vespa-engine.

the class SimpleInheritTestCase method testEmptyChild.

@Test
public void testEmptyChild() throws IOException, ParseException {
    String name = "emptychild";
    final String expectedResultsDirName = "src/test/derived/" + name + "/";
    SearchBuilder builder = new SearchBuilder();
    builder.importFile(expectedResultsDirName + "parent.sd");
    builder.importFile(expectedResultsDirName + "child.sd");
    builder.build();
    Search search = builder.getSearch("child");
    String toDirName = "temp/" + name;
    File toDir = new File(toDirName);
    toDir.mkdirs();
    deleteContent(toDir);
    DerivedConfiguration config = new DerivedConfiguration(search, builder.getRankProfileRegistry(), new QueryProfileRegistry());
    config.export(toDirName);
    checkDir(toDirName, expectedResultsDirName);
}
Also used : Search(com.yahoo.searchdefinition.Search) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) File(java.io.File) Test(org.junit.Test)

Aggregations

SearchBuilder (com.yahoo.searchdefinition.SearchBuilder)36 Test (org.junit.Test)24 Search (com.yahoo.searchdefinition.Search)6 UnprocessingSearchBuilder (com.yahoo.searchdefinition.UnprocessingSearchBuilder)6 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)4 IOException (java.io.IOException)4 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)3 RankProfile (com.yahoo.searchdefinition.RankProfile)3 ParseException (com.yahoo.searchdefinition.parser.ParseException)3 File (java.io.File)3 DocumentmanagerConfig (com.yahoo.document.config.DocumentmanagerConfig)2 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)2 DocumentManager (com.yahoo.vespa.configmodel.producers.DocumentManager)2 Pair (com.yahoo.collections.Pair)1 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)1 DocumenttypesConfig (com.yahoo.document.DocumenttypesConfig)1 AnnotationType (com.yahoo.document.annotation.AnnotationType)1 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)1 DocumentGraphValidator (com.yahoo.searchdefinition.DocumentGraphValidator)1 AttributeFields (com.yahoo.searchdefinition.derived.AttributeFields)1