Search in sources :

Example 1 with SearchBuilder

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

the class Deriver method getUnprocessingSearchBuilder.

public static SearchBuilder getUnprocessingSearchBuilder(List<String> sds) {
    SearchBuilder builder = new UnprocessingSearchBuilder();
    try {
        for (String s : sds) {
            builder.importFile(s);
        }
    } catch (ParseException | IOException e) {
        throw new IllegalArgumentException(e);
    }
    builder.build();
    return builder;
}
Also used : UnprocessingSearchBuilder(com.yahoo.searchdefinition.UnprocessingSearchBuilder) UnprocessingSearchBuilder(com.yahoo.searchdefinition.UnprocessingSearchBuilder) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) ParseException(com.yahoo.searchdefinition.parser.ParseException) IOException(java.io.IOException)

Example 2 with SearchBuilder

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

the class Deriver method getSearchBuilder.

public static SearchBuilder getSearchBuilder(List<String> sds) {
    SearchBuilder builder = new SearchBuilder();
    try {
        for (String s : sds) {
            builder.importFile(s);
        }
    } catch (ParseException | IOException e) {
        throw new IllegalArgumentException(e);
    }
    builder.build();
    return builder;
}
Also used : UnprocessingSearchBuilder(com.yahoo.searchdefinition.UnprocessingSearchBuilder) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) ParseException(com.yahoo.searchdefinition.parser.ParseException) IOException(java.io.IOException)

Example 3 with SearchBuilder

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

the class MailTestCase method testMail.

@Test
public void testMail() throws IOException, ParseException {
    String dir = "src/test/derived/mail/";
    SearchBuilder sb = new SearchBuilder();
    sb.importFile(dir + "mail.sd");
    assertCorrectDeriving(sb, dir);
}
Also used : UnprocessingSearchBuilder(com.yahoo.searchdefinition.UnprocessingSearchBuilder) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) Test(org.junit.Test)

Example 4 with SearchBuilder

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

the class InheritanceTestCase method requireThatStructTypesAreInheritedThroughDiamond.

@Test
public void requireThatStructTypesAreInheritedThroughDiamond() throws IOException, ParseException {
    String dir = "src/test/derived/inheritdiamond/";
    List<String> files = Arrays.asList("grandparent.sd", "mother.sd", "father.sd", "child.sd");
    File outDir = tmpDir.newFolder("out");
    for (int startIdx = 0; startIdx < files.size(); ++startIdx) {
        SearchBuilder builder = new SearchBuilder();
        for (int fileIdx = startIdx; fileIdx < startIdx + files.size(); ++fileIdx) {
            String fileName = files.get(fileIdx % files.size());
            builder.importFile(dir + fileName);
        }
        builder.build();
        DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder();
        DerivedConfiguration.exportDocuments(new DocumentManager().produce(builder.getModel(), b), outDir.getPath());
        DocumentmanagerConfig dc = new DocumentmanagerConfig(b);
        assertEquals(17, dc.datatype().size());
        assertNotNull(structType("child.body", dc));
        DocumentmanagerConfig.Datatype.Structtype childHeader = structType("child.header", dc);
        assertEquals(childHeader.field(0).name(), "foo");
        assertEquals(childHeader.field(1).name(), "bar");
        assertEquals(childHeader.field(2).name(), "baz");
        assertEquals(childHeader.field(3).name(), "cox");
        DocumentmanagerConfig.Datatype.Documenttype child = documentType("child", dc);
        assertEquals(child.inherits(0).name(), "document");
        assertEquals(child.inherits(1).name(), "father");
        assertEquals(child.inherits(2).name(), "mother");
        DocumentmanagerConfig.Datatype.Documenttype mother = documentType("mother", dc);
        assertEquals(mother.inherits(0).name(), "grandparent");
        assertEquals(mother.inherits(1).name(), "document");
    }
}
Also used : DocumentmanagerConfig(com.yahoo.document.config.DocumentmanagerConfig) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) DocumentManager(com.yahoo.vespa.configmodel.producers.DocumentManager) File(java.io.File) Test(org.junit.Test)

Example 5 with SearchBuilder

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

the class InheritanceTestCase method requireThatIndexedStructFieldCanBeInherited.

@Test
public void requireThatIndexedStructFieldCanBeInherited() throws IOException, ParseException {
    String dir = "src/test/derived/inheritstruct/";
    SearchBuilder builder = new SearchBuilder();
    builder.importFile(dir + "parent.sd");
    builder.importFile(dir + "child.sd");
    builder.build();
    derive("inheritstruct", builder, builder.getSearch("child"));
    assertCorrectConfigFiles("inheritstruct");
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) 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