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());
}
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());
}
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"));
}
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;
}
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));
}
Aggregations