Search in sources :

Example 41 with SDField

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

the class IndexingScriptRewriterTestCase method testDynamicAndStaticSummariesRewritingWithIndexing.

@Test
public void testDynamicAndStaticSummariesRewritingWithIndexing() {
    SDField field = createField("test", DataType.STRING, "{ summary | index }");
    field.addSummaryField(createDynamicSummaryField(field, "dyn"));
    field.addSummaryField(createStaticSummaryField(field, "test"));
    field.addSummaryField(createStaticSummaryField(field, "other"));
    field.addSummaryField(createDynamicSummaryField(field, "dyn2"));
    assertIndexingScript("{ input test | tokenize normalize stem:\"SHORTEST\" | summary dyn | summary dyn2 | summary other | " + "summary test | index test; }", field);
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) Test(org.junit.Test)

Example 42 with SDField

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

the class ImplicitStructTypesTestCase method assertField.

private static void assertField(SDDocumentType docType, String fieldName, DataType type) {
    // TODO: get rid of this stupidity
    Field field = getSecretField(docType, fieldName);
    assertNotNull(field);
    assertEquals(type, field.getDataType());
    assertTrue(field instanceof SDField);
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) SDField(com.yahoo.searchdefinition.document.SDField)

Example 43 with SDField

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

the class IndexingScriptRewriterTestCase method testMultiblockTokenize.

@Test
public void testMultiblockTokenize() {
    SDField field = createField("test", DataType.STRING, "{ input test | tokenize | { summary test; }; }");
    assertIndexingScript("{ input test | tokenize | { summary test; }; }", field);
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) Test(org.junit.Test)

Example 44 with SDField

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

the class IndexingScriptRewriterTestCase method createField.

private static SDField createField(String name, DataType type, String script) {
    SDField field = new SDField(null, name, type);
    field.parseIndexingScript(script);
    return field;
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField)

Example 45 with SDField

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

the class Search method allConcreteFields.

/**
 * Returns a list of all the fields of this search definition, that is all fields in all documents, in the documents
 * they inherit, and all extra fields. The caller receives ownership to the list - subsequent changes to it will not
 * impact this
 */
public List<SDField> allConcreteFields() {
    List<SDField> allFields = new ArrayList<>();
    allFields.addAll(extraFieldList());
    for (Field field : docType.fieldSet()) {
        allFields.add((SDField) field);
    }
    return allFields;
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) ImmutableImportedSDField(com.yahoo.searchdefinition.document.ImmutableImportedSDField) SummaryField(com.yahoo.vespa.documentmodel.SummaryField) Field(com.yahoo.document.Field) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) SDField(com.yahoo.searchdefinition.document.SDField) ImmutableImportedSDField(com.yahoo.searchdefinition.document.ImmutableImportedSDField) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) ArrayList(java.util.ArrayList)

Aggregations

SDField (com.yahoo.searchdefinition.document.SDField)85 Test (org.junit.Test)33 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)22 Search (com.yahoo.searchdefinition.Search)15 Attribute (com.yahoo.searchdefinition.document.Attribute)11 Index (com.yahoo.searchdefinition.Index)7 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)7 ArrayList (java.util.ArrayList)7 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)6 Field (com.yahoo.document.Field)6 SummaryField (com.yahoo.vespa.documentmodel.SummaryField)6 ScriptExpression (com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression)6 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)5 ImmutableSDField (com.yahoo.searchdefinition.document.ImmutableSDField)5 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)5 ArrayDataType (com.yahoo.document.ArrayDataType)4 DataType (com.yahoo.document.DataType)4 DocumentReference (com.yahoo.searchdefinition.DocumentReference)4 RankProfile (com.yahoo.searchdefinition.RankProfile)4 TemporarySDField (com.yahoo.searchdefinition.document.TemporarySDField)4