aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp14
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp1
2 files changed, 14 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp
index 9ea598d3578..4f355255db5 100644
--- a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp
@@ -7,11 +7,23 @@ namespace search::tensor {
using vespalib::tensor::Tensor;
+namespace {
+
+const ITensorAttribute &
+getTensorAttribute(const search::attribute::IAttributeVector &attr)
+{
+ const ITensorAttribute *result = attr.asTensorAttribute();
+ assert(result != nullptr);
+ return *result;
+}
+
+}
+
ImportedTensorAttributeVectorReadGuard::ImportedTensorAttributeVectorReadGuard(const attribute::ImportedAttributeVector &imported_attribute,
bool stableEnumGuard)
: ImportedAttributeVectorReadGuard(imported_attribute,
stableEnumGuard),
- _target_tensor_attribute(*imported_attribute.getTargetAttribute()->asTensorAttribute())
+ _target_tensor_attribute(getTensorAttribute(*imported_attribute.getTargetAttribute()))
{
}
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp
index 5e8e4ee0584..2feca5fc0c7 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp
@@ -137,6 +137,7 @@ SingleAttrDFW::insertField(uint32_t docid,
switch (t) {
case BasicType::TENSOR: {
const tensor::ITensorAttribute *tv = v.asTensorAttribute();
+ assert(tv != nullptr);
const auto tensor = tv->getTensor(docid);
if (tensor) {
vespalib::nbostream str;