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);
}
}
}
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.");
}
}
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);
}
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);
}
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");
}
}
Aggregations