summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-06-15 12:34:58 +0000
committerGeir Storli <geirst@verizonmedia.com>2020-06-15 12:34:58 +0000
commitb17ee23a6fd3c81ffc5ca8505b74ac922a6f6165 (patch)
tree94beed5a591d67901373c0e704634eb64cb568cb
parentf0ce676f7de72f90cd5919c33d2fa3fb6ec76c4f (diff)
Remove default tensor spec in doctype builder.
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp9
-rw-r--r--searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/index/doctypebuilder.cpp12
3 files changed, 9 insertions, 16 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index e1785e1e48d..b6d6d2437d8 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -662,10 +662,11 @@ void
addField(Schema & s,
const std::string &name,
Schema::DataType dtype,
- Schema::CollectionType ctype)
+ Schema::CollectionType ctype,
+ const std::string& tensor_spec = "")
{
- s.addSummaryField(Schema::SummaryField(name, dtype, ctype));
- s.addAttributeField(Schema::AttributeField(name, dtype, ctype));
+ s.addSummaryField(Schema::SummaryField(name, dtype, ctype, tensor_spec));
+ s.addAttributeField(Schema::AttributeField(name, dtype, ctype, tensor_spec));
}
@@ -682,7 +683,7 @@ Test::requireThatAttributesAreUsed()
addField(s, "bg", schema::DataType::INT32, CollectionType::WEIGHTEDSET);
addField(s, "bh", schema::DataType::FLOAT, CollectionType::WEIGHTEDSET);
addField(s, "bi", schema::DataType::STRING, CollectionType::WEIGHTEDSET);
- addField(s, "bj", schema::DataType::TENSOR, CollectionType::SINGLE);
+ addField(s, "bj", schema::DataType::TENSOR, CollectionType::SINGLE, "tensor(x{},y{})");
BuildContext bc(s);
DBContext dc(bc._repo, getDocTypeName());
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
index 18235116d27..d1d08a332e3 100644
--- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
@@ -285,8 +285,8 @@ SchemaContext::SchemaContext()
: schema(new Schema()),
builder()
{
- schema->addAttributeField(Schema::AttributeField("tensor", DataType::TENSOR, CollectionType::SINGLE));
- schema->addAttributeField(Schema::AttributeField("tensor2", DataType::TENSOR, CollectionType::SINGLE));
+ schema->addAttributeField(Schema::AttributeField("tensor", DataType::TENSOR, CollectionType::SINGLE, "tensor(x{},y{})"));
+ schema->addAttributeField(Schema::AttributeField("tensor2", DataType::TENSOR, CollectionType::SINGLE, "tensor(x{},y{})"));
addField("i1");
}
diff --git a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp
index 1491e3e21de..4656a5e9edd 100644
--- a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp
+++ b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp
@@ -10,14 +10,6 @@ using namespace document;
namespace search::index {
namespace {
-const vespalib::string default_tensor_data_type = "tensor(x{},y{})";
-
-vespalib::string
-resolve_tensor_spec(const vespalib::string& field_tensor_spec)
-{
- return field_tensor_spec.empty() ? default_tensor_data_type : field_tensor_spec;
-}
-
DataType::Type convert(Schema::DataType type) {
switch (type) {
case schema::DataType::BOOL:
@@ -150,7 +142,7 @@ document::DocumenttypesConfig DocTypeBuilder::makeConfig() const {
}
auto type_id = convert(field.getDataType());
if (type_id == DataType::T_TENSOR) {
- header_struct.addTensorField(field.getName(), resolve_tensor_spec(field.get_tensor_spec()));
+ header_struct.addTensorField(field.getName(), field.get_tensor_spec());
} else {
header_struct.addField(field.getName(), type_cache.getType(
type_id, field.getCollectionType()));
@@ -166,7 +158,7 @@ document::DocumenttypesConfig DocTypeBuilder::makeConfig() const {
}
auto type_id = convert(field.getDataType());
if (type_id == DataType::T_TENSOR) {
- header_struct.addTensorField(field.getName(), resolve_tensor_spec(field.get_tensor_spec()));
+ header_struct.addTensorField(field.getName(), field.get_tensor_spec());
} else {
header_struct.addField(field.getName(), type_cache.getType(
type_id, field.getCollectionType()));