summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-02-01 07:54:01 +0000
committerGeir Storli <geirst@verizonmedia.com>2019-02-01 12:26:00 +0000
commitd3dff498c6004670c902b25fb497cd20bba37c45 (patch)
treed916bb5f817cd317e1bef2fe929344e84de99625 /searchcore
parente8ab2288adce24fd6d05c669d380cd50276524f7 (diff)
Rename AttrUpdate -> AttributeUpdater.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/applyattrupdates/applyattrupdates.cpp4
-rw-r--r--searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt2
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp (renamed from searchcore/src/vespa/searchcore/proton/common/attrupdate.cpp)53
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/attribute_updater.h (renamed from searchcore/src/vespa/searchcore/proton/common/attrupdate.h)5
6 files changed, 44 insertions, 32 deletions
diff --git a/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp b/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp
index 48c02215732..a1cbed20036 100644
--- a/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp
+++ b/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp
@@ -15,7 +15,7 @@
#include <vespa/document/update/documentupdate.h>
#include <vespa/document/update/removevalueupdate.h>
#include <vespa/document/update/mapvalueupdate.h>
-#include <vespa/searchcore/proton/common/attrupdate.h>
+#include <vespa/searchcore/proton/common/attribute_updater.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/attributevector.hpp>
#include <vespa/searchlib/attribute/reference_attribute.h>
@@ -110,7 +110,7 @@ private:
void applyValueUpdate(AttributeVector & vec, uint32_t docId, const ValueUpdate & upd) {
FieldUpdate fupd(_docType->getField(vec.getName()));
fupd.addUpdate(upd);
- search::AttrUpdate::handleUpdate(vec, docId, fupd);
+ search::AttributeUpdater::handleUpdate(vec, docId, fupd);
vec.commit();
}
diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
index 9ab60f06f21..ad5ac55c5e9 100644
--- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
+++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
@@ -8,7 +8,7 @@
#include <vespa/persistence/spi/docentry.h>
#include <vespa/persistence/spi/result.h>
#include <vespa/persistence/spi/test.h>
-#include <vespa/searchcore/proton/common/attrupdate.h>
+#include <vespa/searchcore/proton/common/attribute_updater.h>
#include <vespa/searchcore/proton/persistenceengine/document_iterator.h>
#include <vespa/searchcore/proton/server/commit_and_wait_document_retriever.h>
#include <vespa/searchlib/attribute/attributecontext.h>
@@ -233,7 +233,7 @@ struct AttrUnitDR : public UnitDR
template <class FieldValType, typename FieldValArg>
void addAttribute(AttributeVector &av, const FieldValArg &val) {
- search::AttrUpdate::handleValue(av, docid, FieldValType(val));
+ search::AttributeUpdater::handleValue(av, docid, FieldValType(val));
av.commit();
}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
index 442d04d30c8..9aa2921adf5 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
@@ -5,7 +5,7 @@
#include "attributemanager.h"
#include "document_field_extractor.h"
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
-#include <vespa/searchcore/proton/common/attrupdate.h>
+#include <vespa/searchcore/proton/common/attribute_updater.h>
#include <vespa/searchlib/attribute/attributevector.hpp>
#include <vespa/searchlib/attribute/imported_attribute_vector.h>
#include <vespa/searchlib/common/isequencedtaskexecutor.h>
@@ -102,7 +102,7 @@ applyPutToAttribute(SerialNum serialNum, const FieldValue::UP &fieldValue, Docum
{
ensureLidSpace(serialNum, lid, attr);
if (fieldValue.get()) {
- AttrUpdate::handleValue(attr, lid, *fieldValue);
+ AttributeUpdater::handleValue(attr, lid, *fieldValue);
} else {
attr.clearDoc(lid);
}
@@ -127,7 +127,7 @@ applyUpdateToAttribute(SerialNum serialNum, const FieldUpdate &fieldUpd,
DocumentIdT lid, AttributeVector &attr)
{
ensureLidSpace(serialNum, lid, attr);
- AttrUpdate::handleUpdate(attr, lid, fieldUpd);
+ AttributeUpdater::handleUpdate(attr, lid, fieldUpd);
}
void
@@ -135,7 +135,7 @@ applyUpdateToAttributeAndCommit(SerialNum serialNum, const FieldUpdate &fieldUpd
DocumentIdT lid, AttributeVector &attr)
{
ensureLidSpace(serialNum, lid, attr);
- AttrUpdate::handleUpdate(attr, lid, fieldUpd);
+ AttributeUpdater::handleUpdate(attr, lid, fieldUpd);
attr.commit(serialNum, serialNum);
}
diff --git a/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt
index c2f74c01c2f..84d1cfb471a 100644
--- a/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt
@@ -1,8 +1,8 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_library(searchcore_pcommon STATIC
SOURCES
+ attribute_updater.cpp
attributefieldvaluenode.cpp
- attrupdate.cpp
cachedselect.cpp
commit_time_tracker.cpp
dbdocumentid.cpp
diff --git a/searchcore/src/vespa/searchcore/proton/common/attrupdate.cpp b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp
index d8dc8b9df42..6d17b22ca19 100644
--- a/searchcore/src/vespa/searchcore/proton/common/attrupdate.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp
@@ -1,6 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "attrupdate.h"
+#include "attribute_updater.h"
#include <vespa/document/fieldvalue/arrayfieldvalue.h>
#include <vespa/document/fieldvalue/predicatefieldvalue.h>
#include <vespa/document/fieldvalue/weightedsetfieldvalue.h>
@@ -24,7 +24,7 @@
#include <sstream>
#include <vespa/log/log.h>
-LOG_SETUP(".proton.common.attrupdate");
+LOG_SETUP(".proton.common.attribute_updater");
using namespace document;
using vespalib::make_string;
@@ -120,7 +120,7 @@ private:
template <typename V, typename Accessor>
void
-AttrUpdate::handleUpdateT(V & vec, Accessor, uint32_t lid, const ValueUpdate & upd)
+AttributeUpdater::handleUpdateT(V & vec, Accessor, uint32_t lid, const ValueUpdate & upd)
{
LOG(spam, "handleValueUpdate(%s, %u): %s", vec.getName().c_str(), lid, toString(upd).c_str());
ValueUpdate::ValueUpdateType op = upd.getType();
@@ -181,7 +181,9 @@ AttrUpdate::handleUpdateT(V & vec, Accessor, uint32_t lid, const ValueUpdate & u
}
template <>
-void AttrUpdate::handleUpdate(PredicateAttribute &vec, uint32_t lid, const ValueUpdate &upd) {
+void
+AttributeUpdater::handleUpdate(PredicateAttribute &vec, uint32_t lid, const ValueUpdate &upd)
+{
LOG(spam, "handleValueUpdate(%s, %u): %s", vec.getName().c_str(), lid, toString(upd).c_str());
ValueUpdate::ValueUpdateType op = upd.getType();
assert(!vec.hasMultiValue());
@@ -200,7 +202,9 @@ void AttrUpdate::handleUpdate(PredicateAttribute &vec, uint32_t lid, const Value
}
template <>
-void AttrUpdate::handleUpdate(TensorAttribute &vec, uint32_t lid, const ValueUpdate &upd) {
+void
+AttributeUpdater::handleUpdate(TensorAttribute &vec, uint32_t lid, const ValueUpdate &upd)
+{
LOG(spam, "handleUpdate(%s, %u): %s", vec.getName().c_str(), lid, toString(upd).c_str());
ValueUpdate::ValueUpdateType op = upd.getType();
assert(!vec.hasMultiValue());
@@ -219,7 +223,9 @@ void AttrUpdate::handleUpdate(TensorAttribute &vec, uint32_t lid, const ValueUpd
}
template <>
-void AttrUpdate::handleUpdate(ReferenceAttribute &vec, uint32_t lid, const ValueUpdate &upd) {
+void
+AttributeUpdater::handleUpdate(ReferenceAttribute &vec, uint32_t lid, const ValueUpdate &upd)
+{
LOG(spam, "handleUpdate(%s, %u): %s", vec.getName().c_str(), lid, toString(upd).c_str());
ValueUpdate::ValueUpdateType op = upd.getType();
assert(!vec.hasMultiValue());
@@ -237,7 +243,7 @@ void AttrUpdate::handleUpdate(ReferenceAttribute &vec, uint32_t lid, const Value
}
void
-AttrUpdate::handleUpdate(AttributeVector & vec, uint32_t lid, const FieldUpdate & fUpdate)
+AttributeUpdater::handleUpdate(AttributeVector & vec, uint32_t lid, const FieldUpdate & fUpdate)
{
LOG(spam, "handleFieldUpdate(%s, %u): %s", vec.getName().c_str(), lid, toString(fUpdate).c_str());
for(const auto & update : fUpdate.getUpdates()) {
@@ -276,7 +282,7 @@ AttrUpdate::handleUpdate(AttributeVector & vec, uint32_t lid, const FieldUpdate
}
void
-AttrUpdate::handleValue(AttributeVector & vec, uint32_t lid, const FieldValue & val)
+AttributeUpdater::handleValue(AttributeVector & vec, uint32_t lid, const FieldValue & val)
{
LOG(spam, "handleValue(%s, %u): %s", vec.getName().c_str(), lid, toString(val).c_str());
const vespalib::Identifiable::RuntimeClass & rc = vec.getClass();
@@ -303,7 +309,7 @@ AttrUpdate::handleValue(AttributeVector & vec, uint32_t lid, const FieldValue &
template <typename V, typename Accessor>
void
-AttrUpdate::handleValueT(V & vec, Accessor, uint32_t lid, const FieldValue & val)
+AttributeUpdater::handleValueT(V & vec, Accessor, uint32_t lid, const FieldValue & val)
{
if (vec.hasMultiValue()) {
vec.clearDoc(lid);
@@ -323,7 +329,7 @@ AttrUpdate::handleValueT(V & vec, Accessor, uint32_t lid, const FieldValue & val
}
void
-AttrUpdate::appendValue(IntegerAttribute & vec, uint32_t lid, const FieldValue & val, int weight)
+AttributeUpdater::appendValue(IntegerAttribute & vec, uint32_t lid, const FieldValue & val, int weight)
{
int64_t v = val.getAsLong();
if (!vec.append(lid, v, weight)) {
@@ -333,7 +339,7 @@ AttrUpdate::appendValue(IntegerAttribute & vec, uint32_t lid, const FieldValue &
}
void
-AttrUpdate::removeValue(IntegerAttribute & vec, uint32_t lid, const FieldValue & val)
+AttributeUpdater::removeValue(IntegerAttribute & vec, uint32_t lid, const FieldValue & val)
{
int64_t v = val.getAsLong();
if (!vec.remove(lid, v, 1)) {
@@ -343,7 +349,7 @@ AttrUpdate::removeValue(IntegerAttribute & vec, uint32_t lid, const FieldValue &
}
void
-AttrUpdate::updateValue(IntegerAttribute & vec, uint32_t lid, const FieldValue & val)
+AttributeUpdater::updateValue(IntegerAttribute & vec, uint32_t lid, const FieldValue & val)
{
int64_t v = val.getAsLong();
if (!vec.update(lid, v)) {
@@ -353,7 +359,7 @@ AttrUpdate::updateValue(IntegerAttribute & vec, uint32_t lid, const FieldValue &
}
void
-AttrUpdate::appendValue(FloatingPointAttribute & vec, uint32_t lid, const FieldValue & val, int weight)
+AttributeUpdater::appendValue(FloatingPointAttribute & vec, uint32_t lid, const FieldValue & val, int weight)
{
double v = val.getAsDouble();
if (!vec.append(lid, v, weight)) {
@@ -364,7 +370,7 @@ AttrUpdate::appendValue(FloatingPointAttribute & vec, uint32_t lid, const FieldV
template <typename V, typename Accessor>
void
-AttrUpdate::appendValue(V & vec, uint32_t lid, Accessor & ac)
+AttributeUpdater::appendValue(V & vec, uint32_t lid, Accessor & ac)
{
if (!vec.append(lid, ac)) {
throw UpdateException(make_string("attribute append failed: %s[%u]",
@@ -373,7 +379,7 @@ AttrUpdate::appendValue(V & vec, uint32_t lid, Accessor & ac)
}
void
-AttrUpdate::removeValue(FloatingPointAttribute & vec, uint32_t lid, const FieldValue & val)
+AttributeUpdater::removeValue(FloatingPointAttribute & vec, uint32_t lid, const FieldValue & val)
{
double v = val.getAsDouble();
if (!vec.remove(lid, v, 1)) {
@@ -383,7 +389,7 @@ AttrUpdate::removeValue(FloatingPointAttribute & vec, uint32_t lid, const FieldV
}
void
-AttrUpdate::updateValue(FloatingPointAttribute & vec, uint32_t lid, const FieldValue & val)
+AttributeUpdater::updateValue(FloatingPointAttribute & vec, uint32_t lid, const FieldValue & val)
{
double v = val.getAsDouble();
if (!vec.update(lid, v)) {
@@ -406,7 +412,7 @@ getString(const search::StringAttribute & attr, uint32_t lid, const FieldValue &
}
void
-AttrUpdate::appendValue(StringAttribute & vec, uint32_t lid, const FieldValue & val, int weight)
+AttributeUpdater::appendValue(StringAttribute & vec, uint32_t lid, const FieldValue & val, int weight)
{
const vespalib::string & s = getString(vec, lid, val);
if (!vec.append(lid, s, weight)) {
@@ -416,7 +422,7 @@ AttrUpdate::appendValue(StringAttribute & vec, uint32_t lid, const FieldValue &
}
void
-AttrUpdate::removeValue(StringAttribute & vec, uint32_t lid, const FieldValue & val)
+AttributeUpdater::removeValue(StringAttribute & vec, uint32_t lid, const FieldValue & val)
{
const vespalib::string & v = getString(vec, lid, val);
if (!vec.remove(lid, v, 1)) {
@@ -426,7 +432,7 @@ AttrUpdate::removeValue(StringAttribute & vec, uint32_t lid, const FieldValue &
}
void
-AttrUpdate::updateValue(StringAttribute & vec, uint32_t lid, const FieldValue & val)
+AttributeUpdater::updateValue(StringAttribute & vec, uint32_t lid, const FieldValue & val)
{
const vespalib::string & v = getString(vec, lid, val);
if (!vec.update(lid, v)) {
@@ -435,7 +441,8 @@ AttrUpdate::updateValue(StringAttribute & vec, uint32_t lid, const FieldValue &
}
}
-void AttrUpdate::updateValue(PredicateAttribute &vec, uint32_t lid, const FieldValue &val)
+void
+AttributeUpdater::updateValue(PredicateAttribute &vec, uint32_t lid, const FieldValue &val)
{
if (!val.inherits(PredicateFieldValue::classId)) {
throw UpdateException(
@@ -445,7 +452,8 @@ void AttrUpdate::updateValue(PredicateAttribute &vec, uint32_t lid, const FieldV
vec.updateValue(lid, static_cast<const PredicateFieldValue &>(val));
}
-void AttrUpdate::updateValue(TensorAttribute &vec, uint32_t lid, const FieldValue &val)
+void
+AttributeUpdater::updateValue(TensorAttribute &vec, uint32_t lid, const FieldValue &val)
{
if (!val.inherits(TensorFieldValue::classId)) {
throw UpdateException(
@@ -461,7 +469,8 @@ void AttrUpdate::updateValue(TensorAttribute &vec, uint32_t lid, const FieldValu
}
}
-void AttrUpdate::updateValue(ReferenceAttribute &vec, uint32_t lid, const FieldValue &val)
+void
+AttributeUpdater::updateValue(ReferenceAttribute &vec, uint32_t lid, const FieldValue &val)
{
if (!val.inherits(ReferenceFieldValue::classId)) {
vec.clearDoc(lid);
diff --git a/searchcore/src/vespa/searchcore/proton/common/attrupdate.h b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.h
index cece6d2ceae..01be6299692 100644
--- a/searchcore/src/vespa/searchcore/proton/common/attrupdate.h
+++ b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.h
@@ -15,7 +15,10 @@ namespace attribute {class ReferenceAttribute; }
VESPA_DEFINE_EXCEPTION(UpdateException, vespalib::Exception);
-class AttrUpdate {
+/**
+ * Class used to apply (document) field values and field updates to attribute vectors.
+ */
+class AttributeUpdater {
using Field = document::Field;
using FieldValue = document::FieldValue;
using FieldUpdate = document::FieldUpdate;