aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-06-18 10:11:12 +0000
committerArne Juul <arnej@verizonmedia.com>2021-06-18 10:11:12 +0000
commitb5a61790b9ee966ca92d7c40645899241e72ccff (patch)
tree85ae5c1c27d507e10f8846756b869423b07893f5 /searchlib
parent0aa18d7fd68f42b778652f9e9e75034515b84b82 (diff)
allow tensorFromLabels with collection type "single"
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp
index 76a6e908fcb..24e06cfe639 100644
--- a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp
@@ -45,7 +45,7 @@ TensorFromLabelsBlueprint::setup(const search::fef::IIndexEnvironment &env,
_dimension = _sourceParam;
}
describeOutput("tensor",
- "The tensor created from the given array source (attribute field or query parameter)",
+ "The tensor created from the given source (attribute field or query parameter)",
FeatureType::object(ValueType::make_type(CellType::DOUBLE, {{_dimension}})));
return validSource;
}
@@ -63,10 +63,14 @@ createAttributeExecutor(const search::fef::IQueryEnvironment &env,
" Returning empty tensor.", attrName.c_str());
return ConstantTensorExecutor::createEmpty(ValueType::make_type(CellType::DOUBLE, {{dimension}}), stash);
}
- if (attribute->getCollectionType() != search::attribute::CollectionType::ARRAY ||
- attribute->isFloatingPointType()) {
- LOG(warning, "The attribute vector '%s' is NOT of type array of string or integer."
- " Returning empty tensor.", attrName.c_str());
+ if (attribute->isFloatingPointType()) {
+ LOG(warning, "The attribute vector '%s' must have basic type string or integer."
+ " Returning empty tensor.", attrName.c_str());
+ return ConstantTensorExecutor::createEmpty(ValueType::make_type(CellType::DOUBLE, {{dimension}}), stash);
+ }
+ if (attribute->getCollectionType() == search::attribute::CollectionType::WSET) {
+ LOG(warning, "The attribute vector '%s' is a weighted set - use tensorFromWeightedSet instead."
+ " Returning empty tensor.", attrName.c_str());
return ConstantTensorExecutor::createEmpty(ValueType::make_type(CellType::DOUBLE, {{dimension}}), stash);
}
// Note that for array attribute vectors the default weight is 1.0 for all values.