summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--document/src/tests/documenttestcase.cpp12
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.cpp36
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.h2
-rw-r--r--document/src/vespa/document/select/valuenode.cpp66
-rw-r--r--document/src/vespa/document/select/valuenode.h2
-rw-r--r--document/src/vespa/document/update/addfieldpathupdate.h11
-rw-r--r--document/src/vespa/document/update/fieldpathupdate.h11
-rw-r--r--document/src/vespa/document/update/removefieldpathupdate.h14
-rw-r--r--searchlib/src/vespa/searchlib/expression/documentaccessornode.h6
-rw-r--r--searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp31
-rw-r--r--searchlib/src/vespa/searchlib/expression/documentfieldnode.h50
-rw-r--r--searchlib/src/vespa/searchlib/expression/resultnode.h6
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp4
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.h6
-rw-r--r--vsm/src/vespa/vsm/searcher/fieldsearcher.cpp9
-rw-r--r--vsm/src/vespa/vsm/searcher/fieldsearcher.h11
-rw-r--r--vsm/src/vespa/vsm/vsm/docsumfilter.cpp15
-rw-r--r--vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp2
-rw-r--r--vsm/src/vespa/vsm/vsm/flattendocsumwriter.h2
-rw-r--r--vsm/src/vespa/vsm/vsm/snippetmodifier.cpp2
-rw-r--r--vsm/src/vespa/vsm/vsm/snippetmodifier.h12
21 files changed, 150 insertions, 160 deletions
diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp
index 25c7fa2ac57..8a6cb193aad 100644
--- a/document/src/tests/documenttestcase.cpp
+++ b/document/src/tests/documenttestcase.cpp
@@ -110,11 +110,11 @@ public:
~Handler();
const std::string & getResult() const { return _result; }
private:
- virtual void onPrimitive(const Content&) { _result += 'P'; }
- virtual void onCollectionStart(const Content&) { _result += '['; }
- virtual void onCollectionEnd(const Content&) { _result += ']'; }
- virtual void onStructStart(const Content&) { _result += '<'; }
- virtual void onStructEnd(const Content&) { _result += '>'; }
+ void onPrimitive(uint32_t, const Content&) override { _result += 'P'; }
+ void onCollectionStart(const Content&) override { _result += '['; }
+ void onCollectionEnd(const Content&) override { _result += ']'; }
+ void onStructStart(const Content&) override { _result += '<'; }
+ void onStructEnd(const Content&) override { _result += '>'; }
std::string _result;
};
@@ -190,7 +190,7 @@ public:
~VariableIteratorHandler();
std::string retVal;
- virtual void onPrimitive(const Content & fv) {
+ void onPrimitive(uint32_t, const Content & fv) override {
for (VariableMap::iterator iter = getVariables().begin(); iter != getVariables().end(); iter++) {
retVal += vespalib::make_string("%s: %s,", iter->first.c_str(), iter->second.toString().c_str());
}
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
index 5901ea8b4bf..78840b8ce85 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
@@ -220,12 +220,36 @@ FieldValue::IteratorHandler::IndexValue::toString() const {
}
}
-void FieldValue::IteratorHandler::handlePrimitive(const FieldValue & fv) { onPrimitive(Content(fv, getWeight())); }
-bool FieldValue::IteratorHandler::handleComplex(const FieldValue & fv) { return onComplex(Content(fv, getWeight())); }
-void FieldValue::IteratorHandler::handleCollectionStart(const FieldValue & fv) { onCollectionStart(Content(fv, getWeight())); }
-void FieldValue::IteratorHandler::handleCollectionEnd(const FieldValue & fv) { onCollectionEnd(Content(fv, getWeight())); }
-void FieldValue::IteratorHandler::handleStructStart(const FieldValue & fv) { onStructStart(Content(fv, getWeight())); }
-void FieldValue::IteratorHandler::handleStructEnd(const FieldValue & fv) { onStructEnd(Content(fv, getWeight())); }
+void
+FieldValue::IteratorHandler::handlePrimitive(const FieldValue & fv) {
+ onPrimitive(-1, Content(fv, getWeight()));
+}
+bool
+FieldValue::IteratorHandler::handleComplex(const FieldValue & fv) {
+ return onComplex(Content(fv, getWeight()));
+}
+void
+FieldValue::IteratorHandler::handleCollectionStart(const FieldValue & fv) {
+ onCollectionStart(Content(fv, getWeight()));
+}
+void
+FieldValue::IteratorHandler::handleCollectionEnd(const FieldValue & fv) {
+ onCollectionEnd(Content(fv, getWeight()));
+}
+void
+FieldValue::IteratorHandler::handleStructStart(const FieldValue & fv) {
+ onStructStart(Content(fv, getWeight()));
+}
+void
+FieldValue::IteratorHandler::handleStructEnd(const FieldValue & fv) {
+ onStructEnd(Content(fv, getWeight()));
+}
+
+void
+FieldValue::IteratorHandler::onPrimitive(uint32_t fid, const Content & fv) {
+ (void) fid;
+ (void) fv;
+}
std::string
FieldValue::IteratorHandler::toString(const VariableMap& vars) {
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.h b/document/src/vespa/document/fieldvalue/fieldvalue.h
index 78c8795e412..7d8b7ded976 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.h
@@ -130,7 +130,7 @@ public:
virtual bool createMissingPath() const { return false; }
private:
virtual bool onComplex(const Content& fv) { (void) fv; return true; }
- virtual void onPrimitive(const Content & fv) { (void) fv; }
+ virtual void onPrimitive(uint32_t fid, const Content & fv);
virtual void onCollectionStart(const Content & fv) { (void) fv; }
virtual void onCollectionEnd(const Content & fv) { (void) fv; }
virtual void onStructStart(const Content & fv) { (void) fv; }
diff --git a/document/src/vespa/document/select/valuenode.cpp b/document/src/vespa/document/select/valuenode.cpp
index 54ab19f3087..0552ab8b560 100644
--- a/document/src/vespa/document/select/valuenode.cpp
+++ b/document/src/vespa/document/select/valuenode.cpp
@@ -286,13 +286,12 @@ FieldValueNode::IteratorHandler::getValues() {
}
void
-FieldValueNode::IteratorHandler::onPrimitive(const Content& fv) {
- if (!_firstValue.get() && getVariables().empty()) {
+FieldValueNode::IteratorHandler::onPrimitive(uint32_t fid, const Content& fv) {
+ (void) fid;
+ if (!_firstValue && getVariables().empty()) {
_firstValue = getInternalValue(fv.getValue());
} else {
- _values.push_back(ArrayValue::VariableValue(
- getVariables(),
- Value::SP(getInternalValue(fv.getValue()).release())));
+ _values.emplace_back(getVariables(), Value::SP(getInternalValue(fv.getValue()).release()));
}
}
@@ -303,86 +302,73 @@ FieldValueNode::IteratorHandler::getInternalValue(const FieldValue& fval) const
case document::IntFieldValue::classId:
{
const IntFieldValue& val(dynamic_cast<const IntFieldValue&>(fval));
- return std::unique_ptr<Value>(
- new IntegerValue(val.getAsInt(), false));
+ return std::make_unique<IntegerValue>(val.getAsInt(), false);
}
case document::ByteFieldValue::classId:
{
const ByteFieldValue& val(dynamic_cast<const ByteFieldValue&>(fval));
- return std::unique_ptr<Value>(
- new IntegerValue(val.getAsByte(), false));
+ return std::make_unique<IntegerValue>(val.getAsByte(), false);
}
case LongFieldValue::classId:
{
- const LongFieldValue& val(
- dynamic_cast<const LongFieldValue&>(fval));
- return std::unique_ptr<Value>(
- new IntegerValue(val.getAsLong(), false));
+ const LongFieldValue& val(dynamic_cast<const LongFieldValue&>(fval));
+ return std::make_unique<IntegerValue>(val.getAsLong(), false);
}
case FloatFieldValue::classId:
{
- const FloatFieldValue& val(
- dynamic_cast<const FloatFieldValue&>(fval));
- return std::unique_ptr<Value>(new FloatValue(val.getAsFloat()));
+ const FloatFieldValue& val(dynamic_cast<const FloatFieldValue&>(fval));
+ return std::make_unique<FloatValue>(val.getAsFloat());
}
case DoubleFieldValue::classId:
-
- {
- const DoubleFieldValue& val(
- dynamic_cast<const DoubleFieldValue&>(fval));
- return std::unique_ptr<Value>(new FloatValue(val.getAsDouble()));
+ {
+ const DoubleFieldValue& val(dynamic_cast<const DoubleFieldValue&>(fval));
+ return std::make_unique<FloatValue>(val.getAsDouble());
}
case StringFieldValue::classId:
{
- const StringFieldValue& val(
- dynamic_cast<const StringFieldValue&>(fval));
- return std::unique_ptr<Value>(new StringValue(val.getAsString()));
+ const StringFieldValue& val(dynamic_cast<const StringFieldValue&>(fval));
+ return std::make_unique<StringValue>(val.getAsString());
}
case ArrayFieldValue::classId:
{
- const ArrayFieldValue& val(
- dynamic_cast<const ArrayFieldValue&>(fval));
+ const ArrayFieldValue& val(dynamic_cast<const ArrayFieldValue&>(fval));
if (val.size() == 0) {
- return std::unique_ptr<Value>(new NullValue());
+ return std::make_unique<NullValue>();
} else {
std::vector<ArrayValue::VariableValue> values;
// TODO: Array comparison.
- return std::unique_ptr<Value>(new ArrayValue(values));
+ return std::make_unique<ArrayValue>(values);
}
}
case StructFieldValue::classId:
{
- const StructFieldValue& val(
- dynamic_cast<const StructFieldValue&>(fval));
+ const StructFieldValue& val(dynamic_cast<const StructFieldValue&>(fval));
if (val.empty()) {
- return std::unique_ptr<Value>(new NullValue());
+ return std::make_unique<NullValue>();
} else {
StructValue::ValueMap values;
- for (StructFieldValue::const_iterator it(val.begin());
- it != val.end(); ++it)
- {
+ for (StructFieldValue::const_iterator it(val.begin()); it != val.end(); ++it) {
FieldValue::UP fv(val.getValue(it.field()));
values[it.field().getName()] = Value::SP(getInternalValue(*fv).release());
}
- return std::unique_ptr<Value>(new StructValue(values));
+ return std::make_unique<StructValue>(values);
}
}
case MapFieldValue::classId:
{
- const MapFieldValue& val(
- static_cast<const MapFieldValue&>(fval));
+ const MapFieldValue& val(static_cast<const MapFieldValue&>(fval));
if (val.isEmpty()) {
- return std::unique_ptr<Value>(new NullValue());
+ return std::make_unique<NullValue>();
} else {
std::vector<ArrayValue::VariableValue> values;
// TODO: Map comparison
- return std::unique_ptr<Value>(new ArrayValue(values));
+ return std::make_unique<ArrayValue>(values);
}
}
}
LOG(warning, "Tried to use unsupported datatype %s in field comparison",
fval.getDataType()->toString().c_str());
- return std::unique_ptr<Value>(new InvalidValue());
+ return std::make_unique<InvalidValue>();
}
diff --git a/document/src/vespa/document/select/valuenode.h b/document/src/vespa/document/select/valuenode.h
index cbbc77f8818..77e430c4ec6 100644
--- a/document/src/vespa/document/select/valuenode.h
+++ b/document/src/vespa/document/select/valuenode.h
@@ -280,7 +280,7 @@ private:
std::unique_ptr<Value> _firstValue;
std::vector<ArrayValue::VariableValue> _values;
- virtual void onPrimitive(const Content & fv);
+ void onPrimitive(uint32_t fid, const Content & fv) override;
std::unique_ptr<Value> getInternalValue(const FieldValue& fval) const;
};
diff --git a/document/src/vespa/document/update/addfieldpathupdate.h b/document/src/vespa/document/update/addfieldpathupdate.h
index 7d76df14ec3..529a0b68053 100644
--- a/document/src/vespa/document/update/addfieldpathupdate.h
+++ b/document/src/vespa/document/update/addfieldpathupdate.h
@@ -39,16 +39,13 @@ private:
class AddIteratorHandler : public FieldValue::IteratorHandler
{
public:
- AddIteratorHandler(const ArrayFieldValue& values)
- : _values(values)
- {
- }
+ AddIteratorHandler(const ArrayFieldValue& values) : _values(values) { }
- ModificationStatus doModify(FieldValue& fv);
+ ModificationStatus doModify(FieldValue& fv) override;
- bool createMissingPath() const { return true; }
+ bool createMissingPath() const override { return true; }
- bool onComplex(const Content&) { return false; }
+ bool onComplex(const Content&) override { return false; }
private:
const ArrayFieldValue& _values;
};
diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h
index c083e17197e..d69309cdc39 100644
--- a/document/src/vespa/document/update/fieldpathupdate.h
+++ b/document/src/vespa/document/update/fieldpathupdate.h
@@ -1,15 +1,15 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/objects/cloneable.h>
+#include "updatevisitor.h"
+#include "valueupdate.h"
#include <vespa/document/datatype/datatype.h>
#include <vespa/document/util/serializable.h>
#include <vespa/document/util/xmlserializable.h>
#include <vespa/document/fieldvalue/fieldvalue.h>
#include <vespa/document/select/node.h>
#include <vespa/document/select/resultlist.h>
-#include <vespa/document/update/updatevisitor.h>
-#include <vespa/document/update/valueupdate.h>
+#include <vespa/vespalib/objects/cloneable.h>
namespace document {
@@ -72,7 +72,7 @@ public:
/** @return Whether or not the first field path element is a body field */
bool affectsDocumentBody() const;
- void print(std::ostream& out, bool verbose, const std::string& indent) const;
+ void print(std::ostream& out, bool verbose, const std::string& indent) const override;
DECLARE_IDENTIFIABLE_ABSTRACT(FieldPathUpdate);
@@ -96,8 +96,7 @@ protected:
* @param buffer The byte buffer that contains the serialized object.
* @param version The serialization version of the object to deserialize.
*/
- virtual void deserialize(const DocumentTypeRepo& repo,
- const DataType& type,
+ virtual void deserialize(const DocumentTypeRepo& repo, const DataType& type,
ByteBuffer& buffer, uint16_t version);
/** @return the datatype of the last path element in the field path */
diff --git a/document/src/vespa/document/update/removefieldpathupdate.h b/document/src/vespa/document/update/removefieldpathupdate.h
index 94bd8bf48ae..db5ebde50a7 100644
--- a/document/src/vespa/document/update/removefieldpathupdate.h
+++ b/document/src/vespa/document/update/removefieldpathupdate.h
@@ -1,7 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/document/update/fieldpathupdate.h>
+#include "fieldpathupdate.h"
namespace document {
@@ -16,7 +16,7 @@ public:
stringref fieldPath,
stringref whereClause = stringref());
- FieldPathUpdate* clone() const { return new RemoveFieldPathUpdate(*this); }
+ FieldPathUpdate* clone() const override { return new RemoveFieldPathUpdate(*this); }
bool operator==(const FieldPathUpdate& other) const;
@@ -28,23 +28,21 @@ public:
private:
uint8_t getSerializedType() const override { return RemoveMagic; }
- virtual void deserialize(const DocumentTypeRepo& repo,
- const DataType& type,
- ByteBuffer& buffer, uint16_t version);
+ void deserialize(const DocumentTypeRepo& repo, const DataType& type,
+ ByteBuffer& buffer, uint16_t version) override;
class RemoveIteratorHandler : public FieldValue::IteratorHandler
{
public:
RemoveIteratorHandler() {}
- ModificationStatus doModify(FieldValue&) {
+ ModificationStatus doModify(FieldValue&) override {
return REMOVED;
}
};
std::unique_ptr<FieldValue::IteratorHandler> getIteratorHandler(Document&) const {
- return std::unique_ptr<FieldValue::IteratorHandler>(
- new RemoveIteratorHandler());
+ return std::make_unique<RemoveIteratorHandler>();
}
};
diff --git a/searchlib/src/vespa/searchlib/expression/documentaccessornode.h b/searchlib/src/vespa/searchlib/expression/documentaccessornode.h
index 7fc577d6a53..864223ad250 100644
--- a/searchlib/src/vespa/searchlib/expression/documentaccessornode.h
+++ b/searchlib/src/vespa/searchlib/expression/documentaccessornode.h
@@ -1,7 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/searchlib/expression/expressionnode.h>
+#include "expressionnode.h"
#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/objects/objectoperation.h>
#include <vespa/vespalib/objects/objectpredicate.h>
@@ -18,8 +18,8 @@ public:
public:
Configure(const document::DocumentType & documentType) : _docType(documentType) { }
private:
- virtual void execute(vespalib::Identifiable &obj) { static_cast<DocumentAccessorNode &>(obj).setDocType(_docType); }
- virtual bool check(const vespalib::Identifiable &obj) const { return obj.inherits(DocumentAccessorNode::classId); }
+ void execute(vespalib::Identifiable &obj) override { static_cast<DocumentAccessorNode &>(obj).setDocType(_docType); }
+ bool check(const vespalib::Identifiable &obj) const override { return obj.inherits(DocumentAccessorNode::classId); }
const document::DocumentType & _docType;
};
diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
index 5c85e110692..e4b0a1462f7 100644
--- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
+++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
@@ -1,14 +1,11 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
-#include <vespa/searchlib/expression/documentfieldnode.h>
-#include <vespa/searchlib/expression/getdocidnamespacespecificfunctionnode.h>
-#include <vespa/searchlib/expression/getymumchecksumfunctionnode.h>
+#include "documentfieldnode.h"
+#include "getdocidnamespacespecificfunctionnode.h"
+#include "getymumchecksumfunctionnode.h"
#include <vespa/document/fieldvalue/fieldvalues.h>
-#include <stdexcept>
-#include <vespa/vespalib/objects/visit.h>
+#include <vespa/vespalib/encoding/base64.h>
#include <vespa/log/log.h>
-
LOG_SETUP(".searchlib.documentfieldnode");
namespace search {
@@ -45,7 +42,8 @@ DocumentFieldNode & DocumentFieldNode::operator = (const DocumentFieldNode & rhs
return *this;
}
-std::unique_ptr<ResultNode> deduceResultNode(const vespalib::stringref & fieldName, const FieldValue & fv, bool preserveAccurateTypes, bool nestedMultiValue)
+std::unique_ptr<ResultNode>
+deduceResultNode(const vespalib::stringref & fieldName, const FieldValue & fv, bool preserveAccurateTypes, bool nestedMultiValue)
{
std::unique_ptr<ResultNode> value;
const Identifiable::RuntimeClass & cInfo = fv.getClass();
@@ -147,9 +145,9 @@ class FieldValue2ResultNode : public ResultNode
public:
DECLARE_EXPRESSIONNODE(FieldValue2ResultNode);
FieldValue2ResultNode(const FieldValue * fv=NULL) : _fv(fv) { }
- virtual int64_t onGetInteger(size_t index) const { (void) index; return _fv ? _fv->getAsLong() : 0; }
- virtual double onGetFloat(size_t index) const { (void) index; return _fv ? _fv->getAsDouble() : 0; }
- virtual ConstBufferRef onGetString(size_t index, BufferRef buf) const {
+ int64_t onGetInteger(size_t index) const override { (void) index; return _fv ? _fv->getAsLong() : 0; }
+ double onGetFloat(size_t index) const override { (void) index; return _fv ? _fv->getAsDouble() : 0; }
+ ConstBufferRef onGetString(size_t index, BufferRef buf) const override {
(void) index;
if (_fv) {
std::pair<const char*, size_t> raw = _fv->getAsRaw();
@@ -157,12 +155,9 @@ public:
}
return buf;
}
- virtual void min(const ResultNode & b) { (void) b; }
- virtual void max(const ResultNode & b) { (void) b; }
- virtual void add(const ResultNode & b) { (void) b; }
private:
- virtual void set(const ResultNode&);
- virtual size_t hash() const { return 0; }
+ virtual void set(const ResultNode&) override;
+ virtual size_t hash() const override { return 0; }
const FieldValue * _fv;
};
@@ -196,7 +191,7 @@ bool DocumentFieldNode::onExecute() const
DefaultValue DocumentFieldNode::SingleHandler::_defaultValue;
void
-DocumentFieldNode::SingleHandler::onPrimitive(const Content & c)
+DocumentFieldNode::SingleHandler::onPrimitive(uint32_t, const Content & c)
{
LOG(spam, "SingleHandler::onPrimitive: field value '%s'", c.getValue().toString().c_str());
FieldValue2ResultNode converter(&c.getValue());
@@ -204,7 +199,7 @@ DocumentFieldNode::SingleHandler::onPrimitive(const Content & c)
}
void
-DocumentFieldNode::MultiHandler::onPrimitive(const Content & c)
+DocumentFieldNode::MultiHandler::onPrimitive(uint32_t, const Content & c)
{
LOG(spam, "MultiHandler::onPrimitive: field value '%s'", c.getValue().toString().c_str());
FieldValue2ResultNode converter(&c.getValue());
diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.h b/searchlib/src/vespa/searchlib/expression/documentfieldnode.h
index d40a9fd8836..e5b670be1ea 100644
--- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.h
+++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.h
@@ -1,32 +1,27 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/searchlib/expression/documentaccessornode.h>
-#include <vespa/searchlib/expression/resultnode.h>
-#include <vespa/searchlib/expression/resultvector.h>
-#include <vespa/document/document.h>
-#include <vespa/vespalib/encoding/base64.h>
+#include "documentaccessornode.h"
+#include "resultnode.h"
+#include "resultvector.h"
namespace search {
namespace expression {
-class DefaultValue : public ResultNode
+class DefaultValue final : public ResultNode
{
public:
DECLARE_EXPRESSIONNODE(DefaultValue);
- virtual int64_t onGetInteger(size_t index) const { (void) index; return 0; }
- virtual double onGetFloat(size_t index) const { (void) index; return 0; }
- virtual ConstBufferRef onGetString(size_t index, BufferRef buf) const {
+ int64_t onGetInteger(size_t index) const override { (void) index; return 0; }
+ double onGetFloat(size_t index) const override { (void) index; return 0; }
+ ConstBufferRef onGetString(size_t index, BufferRef buf) const override {
(void) index;
(void) buf;
return ConstBufferRef(&null, 0);
}
- virtual void min(const ResultNode & b) { (void) b; }
- virtual void max(const ResultNode & b) { (void) b; }
- virtual void add(const ResultNode & b) { (void) b; }
private:
- virtual void set(const ResultNode&);
- virtual size_t hash() const { return 0; }
+ void set(const ResultNode&) override;
+ size_t hash() const override { return 0; }
static char null;
};
@@ -34,13 +29,13 @@ class DocumentFieldNode : public DocumentAccessorNode
{
public:
DECLARE_NBO_SERIALIZE;
- virtual void visitMembers(vespalib::ObjectVisitor &visitor) const;
+ void visitMembers(vespalib::ObjectVisitor &visitor) const override;
DECLARE_EXPRESSIONNODE(DocumentFieldNode);
DocumentFieldNode() : _fieldPath(), _value(), _fieldName(), _doc(NULL) { }
DocumentFieldNode(const vespalib::stringref &name) : _fieldPath(), _value(), _fieldName(name), _doc(NULL) { }
DocumentFieldNode(const DocumentFieldNode & rhs);
DocumentFieldNode & operator = (const DocumentFieldNode & rhs);
- virtual const vespalib::string & getFieldName() const { return _fieldName; }
+ const vespalib::string & getFieldName() const override { return _fieldName; }
private:
class Handler : public document::FieldValue::IteratorHandler {
public:
@@ -48,32 +43,32 @@ private:
protected:
typedef document::FieldValue::IteratorHandler::Content Content;
private:
- virtual void onCollectionStart(const Content & c);
- virtual void onStructStart(const Content & c);
+ void onCollectionStart(const Content & c) override;
+ void onStructStart(const Content & c) override;
};
class SingleHandler : public Handler {
public:
SingleHandler(ResultNode & result) : _result(result) {}
private:
- virtual void reset() { _result.set(_defaultValue); }
+ void reset() override { _result.set(_defaultValue); }
ResultNode & _result;
static DefaultValue _defaultValue;
- virtual void onPrimitive(const Content & c);
+ void onPrimitive(uint32_t fid, const Content & c) override;
};
class MultiHandler : public Handler {
public:
MultiHandler(ResultNodeVector & result) : _result(result) {}
private:
- virtual void reset() { _result.clear(); }
+ void reset() override { _result.clear(); }
ResultNodeVector & _result;
- virtual void onPrimitive(const Content & c);
+ void onPrimitive(uint32_t fid, const Content & c) override;
};
- virtual const ResultNode & getResult() const { return *_value; }
- virtual void onPrepare(bool preserveAccurateTypes);
- virtual bool onExecute() const;
- virtual void onDoc(const document::Document & doc);
- virtual void onDocType(const document::DocumentType & docType);
+ const ResultNode & getResult() const override { return *_value; }
+ void onPrepare(bool preserveAccurateTypes) override;
+ bool onExecute() const override;
+ void onDoc(const document::Document & doc) override;
+ void onDocType(const document::DocumentType & docType) override;
document::FieldPath _fieldPath;
mutable ResultNode::CP _value;
mutable std::unique_ptr<Handler> _handler;
@@ -84,4 +79,3 @@ private:
}
}
-
diff --git a/searchlib/src/vespa/searchlib/expression/resultnode.h b/searchlib/src/vespa/searchlib/expression/resultnode.h
index b30ff68c51c..edd76bdcbfa 100644
--- a/searchlib/src/vespa/searchlib/expression/resultnode.h
+++ b/searchlib/src/vespa/searchlib/expression/resultnode.h
@@ -1,8 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/searchlib/expression/expressionnode.h>
-#include <vespa/searchlib/expression/serializer.h>
+#include "expressionnode.h"
+#include "serializer.h"
#include <vespa/vespalib/util/exception.h>
#include <vespa/vespalib/util/buffer.h>
@@ -58,7 +58,7 @@ private:
public:
DECLARE_ABSTRACT_RESULTNODE(ResultNode);
- virtual ~ResultNode() { }
+ ~ResultNode() { }
typedef std::unique_ptr<ResultNode> UP;
typedef vespalib::IdentifiablePtr<ResultNode> CP;
virtual void set(const ResultNode & rhs) = 0;
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
index 16cf83ea0df..287f640ad63 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
@@ -367,7 +367,7 @@ SearchVisitorFactory::makeVisitor(StorageComponent& component,
}
void
-SearchVisitor::AttributeInserter::onPrimitive(const IteratorContent & c)
+SearchVisitor::AttributeInserter::onPrimitive(uint32_t, const IteratorContent & c)
{
const document::FieldValue & value = c.getValue();
LOG(debug, "AttributeInserter: Adding value '%s'(%d) to attribute '%s' for docid '%d'",
@@ -401,7 +401,7 @@ SearchVisitor::PositionInserter::PositionInserter(search::AttributeVector & attr
SearchVisitor::PositionInserter::~PositionInserter() {}
void
-SearchVisitor::PositionInserter::onPrimitive(const IteratorContent & c)
+SearchVisitor::PositionInserter::onPrimitive(uint32_t, const IteratorContent & c)
{
(void) c;
}
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h
index ff30bf09c48..9e4d5a11767 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h
@@ -92,7 +92,7 @@ private:
search::AttributeVector & _attribute;
search::AttributeVector::DocId _docId;
- virtual void onPrimitive(const IteratorContent & c);
+ void onPrimitive(uint32_t fid, const IteratorContent & c) override;
public:
AttributeInserter(search::AttributeVector & attribute, search::AttributeVector::DocId docId);
@@ -103,8 +103,8 @@ private:
PositionInserter(search::AttributeVector & attribute, search::AttributeVector::DocId docId);
~PositionInserter();
private:
- virtual void onPrimitive(const IteratorContent & c);
- virtual void onStructStart(const Content & fv);
+ void onPrimitive(uint32_t fid, const IteratorContent & c) override;
+ void onStructStart(const Content & fv) override;
document::Field _fieldX;
document::Field _fieldY;
document::IntFieldValue _valueX;
diff --git a/vsm/src/vespa/vsm/searcher/fieldsearcher.cpp b/vsm/src/vespa/vsm/searcher/fieldsearcher.cpp
index 68e59a3e395..7459d5d9be7 100644
--- a/vsm/src/vespa/vsm/searcher/fieldsearcher.cpp
+++ b/vsm/src/vespa/vsm/searcher/fieldsearcher.cpp
@@ -1,8 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "fieldsearcher.h"
+#include <vespa/vsm/vsm/fieldsearchspec.h>
#include <vespa/document/fieldvalue/arrayfieldvalue.h>
#include <vespa/document/fieldvalue/weightedsetfieldvalue.h>
-#include <vespa/vsm/vsm/fieldsearchspec.h>
#include <vespa/log/log.h>
LOG_SETUP(".vsm.searcher.fieldsearcher");
@@ -13,8 +13,7 @@ using search::QueryTermList;
using search::v16qi;
using search::Query;
-namespace vsm
-{
+namespace vsm {
class force
{
@@ -44,7 +43,7 @@ FieldSearcherBase::FieldSearcherBase(const FieldSearcherBase & org) :
prepare(org._qtl);
}
-FieldSearcherBase::~FieldSearcherBase(void)
+FieldSearcherBase::~FieldSearcherBase()
{
}
@@ -272,7 +271,7 @@ bool FieldSearcher::onSearch(const StorageDocument & doc)
}
void
-FieldSearcher::IteratorHandler::onPrimitive(const Content & c)
+FieldSearcher::IteratorHandler::onPrimitive(uint32_t, const Content & c)
{
LOG(spam, "onPrimitive: field value '%s'", c.getValue().toString().c_str());
_searcher.setCurrentWeight(c.getWeight());
diff --git a/vsm/src/vespa/vsm/searcher/fieldsearcher.h b/vsm/src/vespa/vsm/searcher/fieldsearcher.h
index 73ad8a9f28a..ee6d3f6698b 100644
--- a/vsm/src/vespa/vsm/searcher/fieldsearcher.h
+++ b/vsm/src/vespa/vsm/searcher/fieldsearcher.h
@@ -5,8 +5,7 @@
#include <vespa/vsm/common/document.h>
#include <vespa/vsm/common/storagedocument.h>
-namespace vsm
-{
+namespace vsm {
typedef size_t termcount_t;
typedef size_t termsize_t;
@@ -50,7 +49,7 @@ public:
};
FieldSearcher(const FieldIdT & fId, bool defaultPrefix=false);
- virtual ~FieldSearcher();
+ ~FieldSearcher();
bool search(const StorageDocument & doc);
virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf);
const FieldIdT & field() const { return _field; }
@@ -85,9 +84,9 @@ private:
typedef document::FieldValue::IteratorHandler::Content Content;
FieldSearcher & _searcher;
- virtual void onPrimitive(const Content & c);
- virtual void onCollectionStart(const Content & c);
- virtual void onStructStart(const Content & c);
+ void onPrimitive(uint32_t fid, const Content & c) override;
+ void onCollectionStart(const Content & c) override;
+ void onStructStart(const Content & c) override;
public:
IteratorHandler(FieldSearcher & searcher) : _searcher(searcher) {}
diff --git a/vsm/src/vespa/vsm/vsm/docsumfilter.cpp b/vsm/src/vespa/vsm/vsm/docsumfilter.cpp
index edf737c09cf..961add6d7d6 100644
--- a/vsm/src/vespa/vsm/vsm/docsumfilter.cpp
+++ b/vsm/src/vespa/vsm/vsm/docsumfilter.cpp
@@ -21,7 +21,7 @@ public:
struct IntResultHandler : public Handler {
int32_t value;
IntResultHandler() : value(0) {}
- virtual void onPrimitive(const Content & c) {
+ void onPrimitive(uint32_t, const Content & c) override {
value = c.getValue().getAsInt();
}
};
@@ -29,7 +29,7 @@ struct IntResultHandler : public Handler {
struct LongResultHandler : public Handler {
int64_t value;
LongResultHandler() : value(0) {}
- virtual void onPrimitive(const Content & c) {
+ void onPrimitive(uint32_t, const Content & c) override {
value = c.getValue().getAsLong();
}
};
@@ -37,7 +37,7 @@ struct LongResultHandler : public Handler {
struct FloatResultHandler : public Handler {
float value;
FloatResultHandler() : value(0) {}
- virtual void onPrimitive(const Content & c) {
+ void onPrimitive(uint32_t, const Content & c) override {
value = c.getValue().getAsFloat();
}
};
@@ -45,7 +45,7 @@ struct FloatResultHandler : public Handler {
struct DoubleResultHandler : public Handler {
double value;
DoubleResultHandler() : value(0) {}
- virtual void onPrimitive(const Content & c) {
+ void onPrimitive(uint32_t, const Content & c) override {
value = c.getValue().getAsDouble();
}
};
@@ -69,7 +69,7 @@ private:
public:
StringResultHandler(ResType t, ResultPacker & p) : _type(t), _packer(p) {}
- virtual void onPrimitive(const Content & c) {
+ void onPrimitive(uint32_t, const Content & c) override {
const document::FieldValue & fv = c.getValue();
if (fv.getClass().inherits(document::LiteralFieldValueB::classId)) {
const document::LiteralFieldValueB & lfv = static_cast<const document::LiteralFieldValueB &>(fv);
@@ -89,7 +89,7 @@ private:
public:
RawResultHandler(ResType t, ResultPacker & p) : _type(t), _packer(p) {}
- virtual void onPrimitive(const Content & c) {
+ void onPrimitive(uint32_t, const Content & c) override {
const document::FieldValue & fv = c.getValue();
try {
std::pair<const char *, size_t> buf = fv.getAsRaw();
@@ -106,8 +106,7 @@ public:
}
}
} catch (document::InvalidDataTypeConversionException & e) {
- LOG(warning, "RawResultHandler: Could not get field value '%s' as raw. Skipping writing this field",
- fv.toString().c_str());
+ LOG(warning, "RawResultHandler: Could not get field value '%s' as raw. Skipping writing this field", fv.toString().c_str());
_packer.AddEmpty();
}
}
diff --git a/vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp b/vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp
index 8685c4ebfa6..4d394d47838 100644
--- a/vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp
+++ b/vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp
@@ -13,7 +13,7 @@ FlattenDocsumWriter::considerSeparator()
}
void
-FlattenDocsumWriter::onPrimitive(const Content & c)
+FlattenDocsumWriter::onPrimitive(uint32_t, const Content & c)
{
considerSeparator();
const document::FieldValue & fv = c.getValue();
diff --git a/vsm/src/vespa/vsm/vsm/flattendocsumwriter.h b/vsm/src/vespa/vsm/vsm/flattendocsumwriter.h
index 26bd6429276..8353caaf2d5 100644
--- a/vsm/src/vespa/vsm/vsm/flattendocsumwriter.h
+++ b/vsm/src/vespa/vsm/vsm/flattendocsumwriter.h
@@ -19,7 +19,7 @@ private:
bool _useSeparator;
void considerSeparator();
- virtual void onPrimitive(const Content & c);
+ void onPrimitive(uint32_t, const Content & c) override;
public:
FlattenDocsumWriter(const vespalib::string & separator = " ");
diff --git a/vsm/src/vespa/vsm/vsm/snippetmodifier.cpp b/vsm/src/vespa/vsm/vsm/snippetmodifier.cpp
index b05cf177b92..ddcb8376733 100644
--- a/vsm/src/vespa/vsm/vsm/snippetmodifier.cpp
+++ b/vsm/src/vespa/vsm/vsm/snippetmodifier.cpp
@@ -41,7 +41,7 @@ SnippetModifier::considerSeparator()
}
void
-SnippetModifier::onPrimitive(const Content & c)
+SnippetModifier::onPrimitive(uint32_t, const Content & c)
{
considerSeparator();
_searcher->onValue(c.getValue());
diff --git a/vsm/src/vespa/vsm/vsm/snippetmodifier.h b/vsm/src/vespa/vsm/vsm/snippetmodifier.h
index 8482ce843ce..148b2cc3ad8 100644
--- a/vsm/src/vespa/vsm/vsm/snippetmodifier.h
+++ b/vsm/src/vespa/vsm/vsm/snippetmodifier.h
@@ -1,12 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/document/fieldvalue/fieldvalue.h>
+#include "fieldsearchspec.h"
#include <vespa/vsm/common/charbuffer.h>
#include <vespa/vsm/common/document.h>
#include <vespa/vsm/common/fieldmodifier.h>
#include <vespa/vsm/searcher/utf8substringsnippetmodifier.h>
-#include <vespa/vsm/vsm/fieldsearchspec.h>
+#include <vespa/document/fieldvalue/fieldvalue.h>
namespace vsm {
@@ -32,7 +32,7 @@ private:
void considerSeparator();
// Inherrit doc from document::FieldValue::IteratorHandler
- virtual void onPrimitive(const Content & c);
+ void onPrimitive(uint32_t, const Content & c) override;
void reset();
public:
@@ -54,7 +54,7 @@ public:
/**
* Modifies the complete given field value.
**/
- virtual document::FieldValue::UP modify(const document::FieldValue & fv) {
+ document::FieldValue::UP modify(const document::FieldValue & fv) override {
return modify(fv, _empty);
}
@@ -67,8 +67,8 @@ public:
* @param path the field path used to iterate the field value.
* @return the new modified field value.
**/
- virtual document::FieldValue::UP modify(const document::FieldValue & fv,
- const document::FieldPath & path);
+ document::FieldValue::UP modify(const document::FieldValue & fv,
+ const document::FieldPath & path) override;
const CharBuffer & getValueBuf() const { return *_valueBuf; }
const UTF8SubstringSnippetModifier::SP & getSearcher() const { return _searcher; }