Search in sources :

Example 1 with ImportedField

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));
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) TemporaryImportedField(com.yahoo.searchdefinition.document.TemporaryImportedField) ImportedField(com.yahoo.searchdefinition.document.ImportedField) DocumentReference(com.yahoo.searchdefinition.DocumentReference)

Example 2 with ImportedField

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));
}
Also used : SummaryField(com.yahoo.vespa.documentmodel.SummaryField) SDField(com.yahoo.searchdefinition.document.SDField) Field(com.yahoo.document.Field) ImportedField(com.yahoo.searchdefinition.document.ImportedField) SDField(com.yahoo.searchdefinition.document.SDField) Search(com.yahoo.searchdefinition.Search) ImportedField(com.yahoo.searchdefinition.document.ImportedField) ImportedFields(com.yahoo.searchdefinition.document.ImportedFields) DocumentReference(com.yahoo.searchdefinition.DocumentReference)

Example 3 with 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());
}
Also used : ImportedField(com.yahoo.searchdefinition.document.ImportedField) TemporaryImportedField(com.yahoo.searchdefinition.document.TemporaryImportedField)

Example 4 with ImportedField

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());
}
Also used : ImportedField(com.yahoo.searchdefinition.document.ImportedField)

Example 5 with ImportedField

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));
}
Also used : SummaryField(com.yahoo.vespa.documentmodel.SummaryField) SDField(com.yahoo.searchdefinition.document.SDField) Field(com.yahoo.document.Field) ImportedField(com.yahoo.searchdefinition.document.ImportedField) SDField(com.yahoo.searchdefinition.document.SDField) Search(com.yahoo.searchdefinition.Search) ImportedField(com.yahoo.searchdefinition.document.ImportedField) ImportedFields(com.yahoo.searchdefinition.document.ImportedFields) DocumentReference(com.yahoo.searchdefinition.DocumentReference)

Aggregations

ImportedField (com.yahoo.searchdefinition.document.ImportedField)5 DocumentReference (com.yahoo.searchdefinition.DocumentReference)3 SDField (com.yahoo.searchdefinition.document.SDField)3 Field (com.yahoo.document.Field)2 Search (com.yahoo.searchdefinition.Search)2 ImportedFields (com.yahoo.searchdefinition.document.ImportedFields)2 TemporaryImportedField (com.yahoo.searchdefinition.document.TemporaryImportedField)2 SummaryField (com.yahoo.vespa.documentmodel.SummaryField)2