use of com.yahoo.searchdefinition.DocumentReference 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.DocumentReference 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.DocumentReference in project vespa by vespa-engine.
the class SearchOrdererTestCase 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));
}
use of com.yahoo.searchdefinition.DocumentReference in project vespa by vespa-engine.
the class ImportedFieldsResolver method validateDocumentReference.
private DocumentReference validateDocumentReference(TemporaryImportedField importedField) {
String referenceFieldName = importedField.referenceFieldName();
DocumentReference reference = references.get().referenceMap().get(referenceFieldName);
if (reference == null) {
fail(importedField, "Reference field '" + referenceFieldName + "' not found");
}
return reference;
}
use of com.yahoo.searchdefinition.DocumentReference 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