Search in sources :

Example 1 with DocumentReference

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));
}
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 DocumentReference

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));
}
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 DocumentReference

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));
}
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) DocumentReference(com.yahoo.searchdefinition.DocumentReference) DocumentReferences(com.yahoo.searchdefinition.DocumentReferences)

Example 4 with DocumentReference

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

Example 5 with DocumentReference

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));
}
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

DocumentReference (com.yahoo.searchdefinition.DocumentReference)5 SDField (com.yahoo.searchdefinition.document.SDField)4 ImportedField (com.yahoo.searchdefinition.document.ImportedField)3 Field (com.yahoo.document.Field)2 Search (com.yahoo.searchdefinition.Search)2 ImportedFields (com.yahoo.searchdefinition.document.ImportedFields)2 SummaryField (com.yahoo.vespa.documentmodel.SummaryField)2 DocumentReferences (com.yahoo.searchdefinition.DocumentReferences)1 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)1 TemporaryImportedField (com.yahoo.searchdefinition.document.TemporaryImportedField)1 TemporarySDField (com.yahoo.searchdefinition.document.TemporarySDField)1 HashMap (java.util.HashMap)1