Search in sources :

Example 46 with SDDocumentType

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

the class ImplicitSearchFieldsTestCase method testRequireThatDynamicSummaryFieldsAreIgnored.

@Test
public void testRequireThatDynamicSummaryFieldsAreIgnored() throws IOException, ParseException {
    Search search = SearchBuilder.buildFromFile("src/test/examples/nextgen/dynamicsummaryfields.sd");
    assertNotNull(search);
    SDDocumentType docType = search.getDocument();
    assertNotNull(docType);
    assertNotNull(docType.getField("rankfeatures"));
    assertNotNull(docType.getField("summaryfeatures"));
    assertNotNull(docType.getField("foo"));
    assertNotNull(docType.getField("bar"));
    assertEquals(4, docType.getFieldCount());
}
Also used : SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Search(com.yahoo.searchdefinition.Search) Test(org.junit.Test)

Example 47 with SDDocumentType

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

the class ImplicitSearchFieldsTestCase method testRequireThatExtraFieldsAreIncluded.

@Test
public void testRequireThatExtraFieldsAreIncluded() throws IOException, ParseException {
    Search search = SearchBuilder.buildFromFile("src/test/examples/nextgen/extrafield.sd");
    assertNotNull(search);
    SDDocumentType docType = search.getDocument();
    assertNotNull(docType);
    assertNotNull(docType.getField("rankfeatures"));
    assertNotNull(docType.getField("summaryfeatures"));
    assertNotNull(docType.getField("foo"));
    assertNotNull(docType.getField("bar"));
    assertEquals(4, docType.getFieldCount());
}
Also used : SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Search(com.yahoo.searchdefinition.Search) Test(org.junit.Test)

Example 48 with SDDocumentType

use of com.yahoo.searchdefinition.document.SDDocumentType 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)

Aggregations

SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)48 Test (org.junit.Test)28 SDField (com.yahoo.searchdefinition.document.SDField)23 Search (com.yahoo.searchdefinition.Search)21 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)7 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)6 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)6 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)5 TemporarySDField (com.yahoo.searchdefinition.document.TemporarySDField)4 ArrayList (java.util.ArrayList)4 DataTypeName (com.yahoo.document.DataTypeName)3 TemporarySDDocumentType (com.yahoo.searchdefinition.document.TemporarySDDocumentType)3 HashMap (java.util.HashMap)3 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)2 DocumentReferences (com.yahoo.searchdefinition.DocumentReferences)2 RankProfile (com.yahoo.searchdefinition.RankProfile)2 SearchBuilder (com.yahoo.searchdefinition.SearchBuilder)2 Iterator (java.util.Iterator)2 LinkedList (java.util.LinkedList)2 DataType (com.yahoo.document.DataType)1