Search in sources :

Example 31 with SearchBuilder

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

the class TwoStreamingStructsTestCase method testTwoStreamingStructsExporting.

@Test
public void testTwoStreamingStructsExporting() throws ParseException, IOException {
    String root = "src/test/derived/twostreamingstructs";
    SearchBuilder builder = new SearchBuilder();
    builder.importFile(root + "/streamingstruct.sd");
    builder.importFile(root + "/whatever.sd");
    builder.build();
    assertCorrectDeriving(builder, builder.getSearch("streamingstruct"), root);
    builder = new SearchBuilder();
    builder.importFile(root + "/streamingstruct.sd");
    builder.importFile(root + "/whatever.sd");
    builder.build();
    assertCorrectDeriving(builder, builder.getSearch("streamingstruct"), root);
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) Test(org.junit.Test)

Example 32 with SearchBuilder

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

the class ImplicitSearchFieldsTestCase method testRequireThatDerivedConfigurationWorks.

@Test
public void testRequireThatDerivedConfigurationWorks() throws IOException, ParseException {
    SearchBuilder sb = new SearchBuilder();
    sb.importFile("src/test/examples/nextgen/simple.sd");
    sb.build();
    assertNotNull(sb.getSearch());
    new DerivedConfiguration(sb.getSearch(), sb.getRankProfileRegistry(), new QueryProfileRegistry());
}
Also used : DerivedConfiguration(com.yahoo.searchdefinition.derived.DerivedConfiguration) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 33 with SearchBuilder

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

the class AbstractExportingTestCase method derive.

protected DerivedConfiguration derive(String dirName, String searchDefinitionName) throws IOException, ParseException {
    File toDir = new File(tempDir + dirName);
    toDir.mkdirs();
    deleteContent(toDir);
    SearchBuilder builder = SearchBuilder.createFromDirectory(searchDefRoot + dirName + "/");
    // SearchBuilder builder = SearchBuilder.createFromFile(searchDefDir + name + ".sd");
    return derive(dirName, searchDefinitionName, builder);
}
Also used : SearchBuilder(com.yahoo.searchdefinition.SearchBuilder)

Example 34 with SearchBuilder

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

the class SearchClusterTest method testSdConfigLogical.

@Test
public void testSdConfigLogical() throws IOException, SAXException {
    // sd1
    SDDocumentType sdt1 = new SDDocumentType("s1");
    Search search1 = new Search("s1", null);
    SDField f1 = new SDField("f1", DataType.STRING);
    f1.addAttribute(new Attribute("f1", DataType.STRING));
    f1.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f1"))));
    sdt1.addField(f1);
    search1.addDocument(sdt1);
    // sd2
    SDDocumentType sdt2 = new SDDocumentType("s2");
    Search search2 = new Search("s2", null);
    SDField f2 = new SDField("f2", DataType.STRING);
    f2.addAttribute(new Attribute("f2", DataType.STRING));
    f2.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f2"))));
    sdt2.addField(f2);
    search2.addDocument(sdt2);
    SearchBuilder builder = new SearchBuilder();
    builder.importRawSearch(search1);
    builder.importRawSearch(search2);
    builder.build();
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Attribute(com.yahoo.searchdefinition.document.Attribute) StatementExpression(com.yahoo.vespa.indexinglanguage.expressions.StatementExpression) Search(com.yahoo.searchdefinition.Search) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) AttributeExpression(com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression) Test(org.junit.Test)

Example 35 with SearchBuilder

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

the class ApplicationPackageUtils method createSearch.

public static Search createSearch(String name, String field1, String field2) throws ParseException {
    SearchBuilder sb = new SearchBuilder();
    sb.importString(generateSearchDefinition(name, field1, field2));
    sb.build();
    return sb.getSearch();
}
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