summaryrefslogtreecommitdiffstats
path: root/vsm
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-04-03 16:16:42 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-04-03 16:16:42 +0200
commitc5b45393eef04591f5012264a69141c29053f7f7 (patch)
tree5173aa0d6c84095e30102d9272631afe56b056b5 /vsm
parent2de59d58030f4d9e3d63636058ec3987258266e6 (diff)
Add field id to the onPrimitive interface.
Diffstat (limited to 'vsm')
-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
7 files changed, 25 insertions, 28 deletions
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; }