Search in sources :

Example 16 with SDDocumentType

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

the class ImplicitSearchFieldsTestCase method testRequireThatUntransformedSummaryFieldsAreIgnored.

@Test
public void testRequireThatUntransformedSummaryFieldsAreIgnored() throws IOException, ParseException {
    Search search = SearchBuilder.buildFromFile("src/test/examples/nextgen/untransformedsummaryfields.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"));
    assertNotNull(docType.getField("baz"));
    assertEquals(5, docType.getFieldCount());
}
Also used : SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Search(com.yahoo.searchdefinition.Search) Test(org.junit.Test)

Example 17 with SDDocumentType

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

the class EmptyRankProfileTestCase method testDeriving.

@Test
public void testDeriving() {
    Search search = new Search("test", null);
    RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(search);
    SDDocumentType doc = new SDDocumentType("test");
    search.addDocument(doc);
    doc.addField(new SDField("a", DataType.STRING));
    SDField field = new SDField("b", DataType.STRING);
    field.setLiteralBoost(500);
    doc.addField(field);
    doc.addField(new SDField("c", DataType.STRING));
    search = SearchBuilder.buildFromRawSearch(search, rankProfileRegistry, new QueryProfileRegistry());
    new DerivedConfiguration(search, rankProfileRegistry, new QueryProfileRegistry());
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Search(com.yahoo.searchdefinition.Search) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) Test(org.junit.Test)

Example 18 with SDDocumentType

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

the class IdTestCase method testExplicitUpperCaseIdField.

@Test
@SuppressWarnings({ "deprecation" })
public void testExplicitUpperCaseIdField() {
    Search search = new Search("test", null);
    SDDocumentType document = new SDDocumentType("test");
    search.addDocument(document);
    SDField uri = new SDField("URI", DataType.URI);
    uri.parseIndexingScript("{ summary | index }");
    document.addField(uri);
    Processing.process(search, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true);
    assertNull(document.getField("uri"));
    assertNull(document.getField("Uri"));
    assertNotNull(document.getField("URI"));
}
Also used : RankProfileRegistry(com.yahoo.searchdefinition.RankProfileRegistry) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Search(com.yahoo.searchdefinition.Search) QueryProfiles(com.yahoo.vespa.model.container.search.QueryProfiles) Test(org.junit.Test)

Example 19 with SDDocumentType

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

the class DocumentGraphValidatorTest method createSearchWithName.

private static Search createSearchWithName(String name, Search... parents) {
    Search campaignSearch = new Search(name, null);
    SDDocumentType document = new SDDocumentType(name);
    campaignSearch.addDocument(document);
    document.setDocumentReferences(new DocumentReferences(Collections.emptyMap()));
    Arrays.stream(parents).map(Search::getDocument).forEach(document::inherit);
    return campaignSearch;
}
Also used : SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType)

Example 20 with SDDocumentType

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

the class DocumentGraphValidatorTest method createDocumentReference.

private static void createDocumentReference(Search from, Search to, String refFieldName) {
    SDField refField = new TemporarySDField(refFieldName, ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create(to.getName())));
    SDDocumentType fromDocument = from.getDocument();
    fromDocument.addField(refField);
    Map<String, DocumentReference> originalMap = fromDocument.getDocumentReferences().get().referenceMap();
    HashMap<String, DocumentReference> modifiedMap = new HashMap<>(originalMap);
    modifiedMap.put(refFieldName, new DocumentReference(refField, to));
    fromDocument.setDocumentReferences(new DocumentReferences(modifiedMap));
}
Also used : TemporarySDField(com.yahoo.searchdefinition.document.TemporarySDField) SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) HashMap(java.util.HashMap) TemporarySDField(com.yahoo.searchdefinition.document.TemporarySDField)

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