summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-02-22 13:25:19 +0000
committerArne Juul <arnej@verizonmedia.com>2021-02-22 13:25:21 +0000
commitf3b69ab71ac7dde197f25ffd67d5851648ebafbc (patch)
treee91c9dee83d7dcf20a7f1be8c67b0d326ccb4e0f /searchcore
parent6a81c9802ce151c9a7ec47234a7f34bd7c1c6a56 (diff)
move getting tensor into the attribute code
* avoids taking an extra copy of the tensor in the DirectTensorAttribute case
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp
index 8fb165cb0b8..4d12fdfcf5b 100644
--- a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp
@@ -205,23 +205,6 @@ AttributeUpdater::handleUpdate(PredicateAttribute &vec, uint32_t lid, const Valu
}
}
-namespace {
-
-void
-applyTensorUpdate(TensorAttribute &vec, uint32_t lid, const document::TensorUpdate &update,
- bool create_empty_if_non_existing)
-{
- auto oldTensor = vec.getTensor(lid);
- if (!oldTensor && create_empty_if_non_existing) {
- oldTensor = vec.getEmptyTensor();
- }
- if (oldTensor) {
- vec.update_tensor(lid, update, *oldTensor);
- }
-}
-
-}
-
template <>
void
AttributeUpdater::handleUpdate(TensorAttribute &vec, uint32_t lid, const ValueUpdate &upd)
@@ -236,11 +219,11 @@ AttributeUpdater::handleUpdate(TensorAttribute &vec, uint32_t lid, const ValueUp
updateValue(vec, lid, assign.getValue());
}
} else if (op == ValueUpdate::TensorModifyUpdate) {
- applyTensorUpdate(vec, lid, static_cast<const TensorModifyUpdate &>(upd), false);
+ vec.update_tensor(lid, static_cast<const TensorModifyUpdate &>(upd), false);
} else if (op == ValueUpdate::TensorAddUpdate) {
- applyTensorUpdate(vec, lid, static_cast<const TensorAddUpdate &>(upd), true);
+ vec.update_tensor(lid, static_cast<const TensorAddUpdate &>(upd), true);
} else if (op == ValueUpdate::TensorRemoveUpdate) {
- applyTensorUpdate(vec, lid, static_cast<const TensorRemoveUpdate &>(upd), false);
+ vec.update_tensor(lid, static_cast<const TensorRemoveUpdate &>(upd), false);
} else if (op == ValueUpdate::Clear) {
vec.clearDoc(lid);
} else {