use of com.yahoo.searchdefinition.document.ImportedField in project vespa by vespa-engine.
the class ImportedFieldsResolver method resolveImportedField.
private void resolveImportedField(TemporaryImportedField importedField, boolean validate) {
DocumentReference reference = validateDocumentReference(importedField);
SDField targetField = validateTargetField(importedField, reference, validate);
importedFields.put(importedField.fieldName(), new ImportedField(importedField.fieldName(), reference, targetField));
}
use of com.yahoo.searchdefinition.document.ImportedField in project vespa by vespa-engine.
the class ValidateFieldTypesTest method createSingleImportedField.
private static ImportedFields createSingleImportedField(String fieldName, DataType dataType) {
Search targetSearch = new Search("target_doc", MockApplicationPackage.createEmpty());
SDField targetField = new SDField("target_field", dataType);
DocumentReference documentReference = new DocumentReference(new Field("reference_field"), targetSearch);
ImportedField importedField = new ImportedField(fieldName, documentReference, targetField);
return new ImportedFields(Collections.singletonMap(fieldName, importedField));
}
use of com.yahoo.searchdefinition.document.ImportedField in project vespa by vespa-engine.
the class ImportedFieldsResolverTestCase method resolve_imported_field.
private void resolve_imported_field(String fieldName, String targetFieldName) {
SearchModel model = new SearchModel();
model.addImportedField(fieldName, "ref", targetFieldName).resolve();
assertEquals(1, model.importedFields.fields().size());
ImportedField myField = model.importedFields.fields().get(fieldName);
assertNotNull(myField);
assertEquals(fieldName, myField.fieldName());
assertSame(model.childSearch.getConcreteField("ref"), myField.reference().referenceField());
assertSame(model.parentSearch, myField.reference().targetSearch());
assertSame(model.parentSearch.getConcreteField(targetFieldName), myField.targetField());
}
use of com.yahoo.searchdefinition.document.ImportedField in project vespa by vespa-engine.
the class ImportedFieldsTestCase method assertSearchContainsImportedField.
private static void assertSearchContainsImportedField(String fieldName, String referenceFieldName, String referenceDocType, String targetFieldName, Search search) {
ImportedField importedField = search.importedFields().get().fields().get(fieldName);
assertNotNull(importedField);
assertEquals(fieldName, importedField.fieldName());
assertEquals(referenceFieldName, importedField.reference().referenceField().getName());
assertEquals(referenceDocType, importedField.reference().targetSearch().getName());
assertEquals(targetFieldName, importedField.targetField().getName());
}
use of com.yahoo.searchdefinition.document.ImportedField in project vespa by vespa-engine.
the class AddAttributeTransformToSummaryOfImportedFieldsTest method createSingleImportedField.
private static ImportedFields createSingleImportedField(String fieldName) {
Search targetSearch = new Search("target_doc", MockApplicationPackage.createEmpty());
SDField targetField = new SDField("target_field", DataType.INT);
DocumentReference documentReference = new DocumentReference(new Field("reference_field"), targetSearch);
ImportedField importedField = new ImportedField(fieldName, documentReference, targetField);
return new ImportedFields(Collections.singletonMap(fieldName, importedField));
}
Aggregations