summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@verizonmedia.com>2019-03-05 21:04:10 +0100
committerTor Egge <Tor.Egge@verizonmedia.com>2019-03-08 11:03:37 +0100
commita2150691242daeeca391ba56579abdee6dbd044f (patch)
treefe456a6b06a6c6f64cbf7817c97b79ac18da4621 /searchcore
parent511cdf2bea96cb39c7aee78b720fb9f05ba0a780 (diff)
Populate tensor field from tensor attribute.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp
index 3ce54b790c1..e30667039f0 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp
@@ -100,6 +100,22 @@ setValue(DocumentIdT lid,
}
}
+void
+setTensorValue(DocumentIdT lid, Document &doc,
+ const vespalib::string &fieldName,
+ const IAttributeVector &attr)
+{
+ const auto &tensorAttribute = static_cast<const TensorAttribute &>(attr);
+ auto tensor = tensorAttribute.getTensor(lid);
+ if (tensor) {
+ auto tensorField = doc.getField(fieldName).createValue();
+ dynamic_cast<TensorFieldValue &>(*tensorField) = std::move(tensor);
+ doc.setValue(fieldName, *tensorField);
+ } else {
+ doc.remove(fieldName);
+ }
+}
+
}
void
@@ -136,8 +152,7 @@ DocumentFieldRetriever::populate(DocumentIdT lid,
// Predicate attribute doesn't store documents, it only indexes them.
break;
case BasicType::TENSOR:
- // Tensor attribute is not authorative. Partial updates must update
- // document store.
+ setTensorValue(lid, doc, fieldName, attr);
break;
case BasicType::REFERENCE:
// Reference attribute doesn't store full document id.