Search in sources :

Example 21 with SDField

use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.

the class TensorFieldProcessor method process.

@Override
public void process(boolean validate) {
    if (!validate)
        return;
    for (SDField field : search.allConcreteFields()) {
        if (field.getDataType() instanceof TensorDataType) {
            validateIndexingScripsForTensorField(field);
            validateAttributeSettingForTensorField(field);
        } else if (field.getDataType() instanceof CollectionDataType) {
            validateDataTypeForCollectionField(field);
        }
    }
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) TensorDataType(com.yahoo.document.TensorDataType) CollectionDataType(com.yahoo.document.CollectionDataType)

Example 22 with SDField

use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.

the class AddExtraFieldsToDocument method addSummaryField.

private void addSummaryField(Search search, SDDocumentType document, SummaryField field, boolean validate) {
    Field docField = document.getField(field.getName());
    if (docField == null) {
        ImmutableSDField existingField = search.getField(field.getName());
        if (existingField == null) {
            SDField newField = new SDField(document, field.getName(), field.getDataType(), field.isHeader(), true);
            newField.setIsExtraField(true);
            document.addField(newField);
        } else if (!existingField.isImportedField()) {
            document.addField(existingField.asField());
        }
    } else if (!docField.getDataType().equals(field.getDataType())) {
        if (validate)
            throw newProcessException(search, field, "Summary field has conflicting type.");
    }
}
Also used : SummaryField(com.yahoo.vespa.documentmodel.SummaryField) SDField(com.yahoo.searchdefinition.document.SDField) Field(com.yahoo.document.Field) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) SDField(com.yahoo.searchdefinition.document.SDField) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField)

Example 23 with SDField

use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.

the class AddExtraFieldsToDocument method addSdField.

private void addSdField(Search search, SDDocumentType document, SDField field, boolean validate) {
    if (field.getIndexToCount() == 0 && field.getAttributes().isEmpty()) {
        return;
    }
    for (Attribute atr : field.getAttributes().values()) {
        if (atr.getName().equals(field.getName() + "_position")) {
            DataType type = PositionDataType.INSTANCE;
            if (atr.getCollectionType().equals(Attribute.CollectionType.ARRAY)) {
                type = DataType.getArray(type);
            }
            addField(search, document, new SDField(document, atr.getName(), type), validate);
        } else if (!atr.getName().equals(field.getName())) {
            addField(search, document, new SDField(document, atr.getName(), atr.getDataType()), validate);
        }
    }
    addField(search, document, field, validate);
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) Attribute(com.yahoo.searchdefinition.document.Attribute) PositionDataType(com.yahoo.document.PositionDataType) DataType(com.yahoo.document.DataType)

Example 24 with SDField

use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.

the class StructFieldOperation method apply.

public void apply(SDField field) {
    SDField structField = field.getStructField(structFieldName);
    if (structField == null) {
        throw new IllegalArgumentException("Struct field '" + structFieldName + "' has not been defined in struct " + "for field '" + field.getName() + "'.");
    }
    applyOperations(structField);
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField)

Example 25 with SDField

use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.

the class WordMatch method process.

public void process(boolean validate) {
    for (SDField field : search.allConcreteFields()) {
        if (!field.getMatching().getType().equals(Matching.Type.WORD))
            continue;
        field.setStemming(Stemming.NONE);
        field.getNormalizing().inferLowercase();
        field.addQueryCommand("word");
    }
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField)

Aggregations

SDField (com.yahoo.searchdefinition.document.SDField)85 Test (org.junit.Test)33 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)22 Search (com.yahoo.searchdefinition.Search)15 Attribute (com.yahoo.searchdefinition.document.Attribute)11 Index (com.yahoo.searchdefinition.Index)7 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)7 ArrayList (java.util.ArrayList)7 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)6 Field (com.yahoo.document.Field)6 SummaryField (com.yahoo.vespa.documentmodel.SummaryField)6 ScriptExpression (com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression)6 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)5 ImmutableSDField (com.yahoo.searchdefinition.document.ImmutableSDField)5 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)5 ArrayDataType (com.yahoo.document.ArrayDataType)4 DataType (com.yahoo.document.DataType)4 DocumentReference (com.yahoo.searchdefinition.DocumentReference)4 RankProfile (com.yahoo.searchdefinition.RankProfile)4 TemporarySDField (com.yahoo.searchdefinition.document.TemporarySDField)4