summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2018-09-11 08:48:53 +0000
committerTor Egge <Tor.Egge@oath.com>2018-09-11 08:48:53 +0000
commitd10029c22ea768381ed7a5c7242858b2d4fd64e2 (patch)
tree004e52f9e8169f4dd8736914cc94071ed3783a50 /searchlib
parentfce52c393e9c5f1bc0427614f46d9c2150418fea (diff)
Use proper inheritance for (de)serialize.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/expression/attributenode/attribute_node_test.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h2
3 files changed, 8 insertions, 7 deletions
diff --git a/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp b/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp
index fa7972eb928..ec1a86bca69 100644
--- a/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp
+++ b/searchlib/src/tests/expression/attributenode/attribute_node_test.cpp
@@ -75,11 +75,11 @@ makeAttributeMapLookupNode(const vespalib::string attributeName)
if (rightBracePos != vespalib::string::npos && rightBracePos > leftBracePos) {
if (attributeName[leftBracePos + 1] == '"' && attributeName[rightBracePos - 1] == '"') {
vespalib::string key = attributeName.substr(leftBracePos + 2, rightBracePos - leftBracePos - 3);
- return std::make_unique<AttributeMapLookupNode>(keyName.str(), valueName.str(), key, "");
+ return std::make_unique<AttributeMapLookupNode>(attributeName, keyName.str(), valueName.str(), key, "");
} else if (attributeName.substr(leftBracePos + 1, indirectKeyMarker.size()) == indirectKeyMarker && attributeName[rightBracePos - 1] == ')') {
auto startPos = leftBracePos + 1 + indirectKeyMarker.size();
vespalib::string keySourceAttributeName = attributeName.substr(startPos, rightBracePos - 1 - startPos);
- return std::make_unique<AttributeMapLookupNode>(keyName.str(), valueName.str(), "", keySourceAttributeName);
+ return std::make_unique<AttributeMapLookupNode>(attributeName, keyName.str(), valueName.str(), "", keySourceAttributeName);
}
}
return std::unique_ptr<AttributeNode>();
diff --git a/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp b/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp
index 4ec21bbcb9f..8a851b043aa 100644
--- a/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp
+++ b/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.cpp
@@ -245,8 +245,8 @@ AttributeMapLookupNode::AttributeMapLookupNode()
AttributeMapLookupNode::AttributeMapLookupNode(const AttributeMapLookupNode &) = default;
-AttributeMapLookupNode::AttributeMapLookupNode(vespalib::stringref keyAttributeName, vespalib::stringref valueAttributeName, vespalib::stringref key, vespalib::stringref keySourceAttributeName)
- : AttributeNode(""),
+AttributeMapLookupNode::AttributeMapLookupNode(vespalib::stringref name, vespalib::stringref keyAttributeName, vespalib::stringref valueAttributeName, vespalib::stringref key, vespalib::stringref keySourceAttributeName)
+ : AttributeNode(name),
_keyAttributeName(keyAttributeName),
_valueAttributeName(valueAttributeName),
_key(key),
@@ -382,19 +382,20 @@ AttributeMapLookupNode::wireAttributes(const search::attribute::IAttributeContex
Serializer & AttributeMapLookupNode::onSerialize(Serializer & os) const
{
- FunctionNode::onSerialize(os);
+ AttributeNode::onSerialize(os);
return os << _keyAttributeName << _valueAttributeName << _key << _keySourceAttributeName;
}
Deserializer & AttributeMapLookupNode::onDeserialize(Deserializer & is)
{
- FunctionNode::onDeserialize(is);
+ AttributeNode::onDeserialize(is);
return is >> _keyAttributeName >> _valueAttributeName >> _key >> _keySourceAttributeName;
}
void
AttributeMapLookupNode::visitMembers(vespalib::ObjectVisitor &visitor) const
{
+ AttributeNode::visitMembers(visitor);
visit(visitor, "keyAttributeName", _keyAttributeName);
visit(visitor, "keySourceAttributeName", _keySourceAttributeName);
visit(visitor, "valueAttributeName", _valueAttributeName);
diff --git a/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h b/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h
index 86b60b079ce..2f9c6328969 100644
--- a/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h
+++ b/searchlib/src/vespa/searchlib/expression/attribute_map_lookup_node.h
@@ -33,7 +33,7 @@ public:
DECLARE_NBO_SERIALIZE;
DECLARE_EXPRESSIONNODE(AttributeMapLookupNode);
AttributeMapLookupNode();
- AttributeMapLookupNode(vespalib::stringref keyAttributeName, vespalib::stringref valueAttributeName, vespalib::stringref key, vespalib::stringref keySourceAttributeName);
+ AttributeMapLookupNode(vespalib::stringref name, vespalib::stringref keyAttributeName, vespalib::stringref valueAttributeName, vespalib::stringref key, vespalib::stringref keySourceAttributeName);
AttributeMapLookupNode(const AttributeMapLookupNode &);
AttributeMapLookupNode(AttributeMapLookupNode &&) = delete;
~AttributeMapLookupNode() override;