Search in sources :

Example 6 with SearchBuilder

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

the class InheritanceTestCase method requireThatStructTypesAreInheritedFromGrandParent.

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

Example 7 with SearchBuilder

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

the class ImportedFieldsTestCase method buildAdSearch.

private static Search buildAdSearch(String sdContent) throws ParseException {
    SearchBuilder builder = new SearchBuilder();
    builder.importString(joinLines("search campaign {", "  document campaign {", "    field budget type int { indexing: attribute }", "  }", "}"));
    builder.importString(joinLines("search person {", "  document person {", "    field name type string { indexing: attribute }", "  }", "}"));
    builder.importString(sdContent);
    builder.build();
    return builder.getSearch("ad");
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder)

Example 8 with SearchBuilder

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

the class DocumentDeriverTestCase method testDocumentDeriving.

@Test
public void testDocumentDeriving() {
    String root = "src/test/derived/documentderiver/";
    List<String> files = new ArrayList<>();
    files.add(root + "newsarticle.sd");
    files.add(root + "newssummary.sd");
    files.add(root + "music.sd");
    files.add(root + "mail.sd");
    files.add(root + "compression_header.sd");
    files.add(root + "compression_both.sd");
    files.add(root + "compression_body.sd");
    File toDir = new File("temp/documentderiver/");
    toDir.mkdir();
    SearchBuilder builder = Deriver.deriveDocuments(files, toDir.getPath());
    try {
        assertEqualFiles(root + "documentmanager.cfg", toDir.getPath() + "/documentmanager.cfg");
    } catch (IOException e) {
        throw new RuntimeException("Exception while comparing files", e);
    }
    SDDocumentType doc = builder.getSearch("newsarticle").getDocument();
    assertNotNull(doc);
}
Also used : SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) ArrayList(java.util.ArrayList) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) IOException(java.io.IOException) File(java.io.File) Test(org.junit.Test)

Example 9 with SearchBuilder

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

the class DocumentModelBuilderTestCase method testMultipleInheritanceArray.

@Test
public void testMultipleInheritanceArray() throws IOException, ParseException {
    SearchBuilder search = new SearchBuilder();
    search.importFile("src/test/cfg/search/data/travel/searchdefinitions/TTData.sd");
    search.importFile("src/test/cfg/search/data/travel/searchdefinitions/TTEdge.sd");
    search.importFile("src/test/cfg/search/data/travel/searchdefinitions/TTPOI.sd");
    search.build();
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) Test(org.junit.Test)

Example 10 with SearchBuilder

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

the class DocumentModelBuilderTestCase method createAndTestModel.

private DocumentModel createAndTestModel(String sd) throws IOException, ParseException {
    SearchBuilder search = SearchBuilder.createFromFile(sd);
    DocumentModel model = search.getModel();
    assertEquals(2, model.getDocumentManager().getTypes().size());
    assertNotNull(model.getDocumentManager().getDocumentType("document"));
    assertNotNull(model.getDocumentManager().getDocumentType("types"));
    return model;
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder)

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