summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--document/src/vespa/document/update/fieldpathupdate.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp15
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp7
-rw-r--r--searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp6
-rw-r--r--vsm/src/tests/docsum/docsum.cpp24
-rw-r--r--vsm/src/tests/document/document.cpp8
-rw-r--r--vsm/src/vespa/vsm/common/documenttypemapping.cpp13
8 files changed, 40 insertions, 40 deletions
diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h
index 5dac15c12f1..60c1565316c 100644
--- a/document/src/vespa/document/update/fieldpathupdate.h
+++ b/document/src/vespa/document/update/fieldpathupdate.h
@@ -57,9 +57,6 @@ public:
return ! (*this == other);
}
- const FieldPath& getFieldPath() const { return _fieldPath; }
- const select::Node& getWhereClause() const { return *_whereClause; }
-
const vespalib::string& getOriginalFieldPath() const { return _originalFieldPath; }
const vespalib::string& getOriginalWhereClause() const { return _originalWhereClause; }
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
index 49c1eed6327..740f65ea27b 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
@@ -42,15 +42,8 @@ AttributeWriter::WriteContext::buildFieldPaths(const DocumentType &docType)
size_t fieldId = 0;
for (const auto &attrp : _attributes) {
const vespalib::string &name = attrp->getName();
- FieldPath::UP fp = docType.buildFieldPath(name);
- if (!fp) {
- LOG(warning,
- "Mismatch between documentdefinition and schema. "
- "No field named '%s' from schema in document type '%s'. "
- "This might happen if an attribute field has been added and you are feeding while reconfiguring",
- name.c_str(),
- docType.getName().c_str());
- }
+ FieldPath fp;
+ docType.buildFieldPath(fp, name);
assert(fieldId < _fieldPaths.size());
_fieldPaths[fieldId] = std::move(fp);
++fieldId;
@@ -206,9 +199,7 @@ PutTask::PutTask(const AttributeWriter::WriteContext &wc, SerialNum serialNum, c
_fieldValues.reserve(fieldPaths.size());
for (const auto &fieldPath : fieldPaths) {
FieldValue::UP fv;
- if (fieldPath) {
- fv = doc.getNestedFieldValue(fieldPath->getFullRange());
- }
+ fv = doc.getNestedFieldValue(fieldPath.getFullRange());
_fieldValues.emplace_back(std::move(fv));
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h
index ada0a767306..58b92459358 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h
@@ -26,7 +26,7 @@ public:
class WriteContext
{
uint32_t _executorId;
- std::vector<std::unique_ptr<FieldPath>> _fieldPaths;
+ std::vector<FieldPath> _fieldPaths;
std::vector<AttributeVector *> _attributes;
public:
WriteContext(uint32_t executorId);
@@ -36,7 +36,7 @@ public:
void buildFieldPaths(const DocumentType &docType);
void add(AttributeVector *attr);
uint32_t getExecutorId() const { return _executorId; }
- const std::vector<std::unique_ptr<FieldPath>> &getFieldPaths() const { return _fieldPaths; }
+ const std::vector<FieldPath> &getFieldPaths() const { return _fieldPaths; }
const std::vector<AttributeVector *> &getAttributes() const { return _attributes; }
};
private:
diff --git a/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp b/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
index 91246dcb7e7..2cd6e7d9255 100644
--- a/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
@@ -398,11 +398,8 @@ SelectPruner::visitFieldValueNode(const FieldValueNode &expr)
return;
}
try {
- FieldPath::UP path(docType->buildFieldPath(expr.getFieldName()));
- if (path.get() == NULL) {
- setInvalidVal();
- return;
- }
+ FieldPath path;
+ docType->buildFieldPath(path, expr.getFieldName());
} catch (vespalib::IllegalArgumentException &) {
setInvalidVal();
return;
diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
index a2679643784..d7209f4dd6d 100644
--- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
+++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
@@ -139,11 +139,11 @@ void DocumentFieldNode::onPrepare(bool preserveAccurateTypes)
void DocumentFieldNode::onDocType(const DocumentType & docType)
{
LOG(debug, "DocumentFieldNode::onDocType(this=%p)", this);
- FieldPath::UP path = docType.buildFieldPath(_fieldName);
- if (!path.get() || path->empty()) {
+ _fieldPath.clear();
+ docType.buildFieldPath(_fieldPath, _fieldName);
+ if (_fieldPath.empty()) {
throw std::runtime_error(make_string("Field %s could not be loacated in documenttype %s", _fieldName.c_str(), docType.getName().c_str()));
}
- _fieldPath = *path;
}
class FieldValue2ResultNode : public ResultNode
diff --git a/vsm/src/tests/docsum/docsum.cpp b/vsm/src/tests/docsum/docsum.cpp
index 52baefbfc0e..a3c8cba14b5 100644
--- a/vsm/src/tests/docsum/docsum.cpp
+++ b/vsm/src/tests/docsum/docsum.cpp
@@ -195,8 +195,16 @@ DocsumTest::testSlimeFieldWriter()
{ // select a subset and then all
SlimeFieldWriter sfw;
DocsumFieldSpec::FieldIdentifierVector fields;
- fields.push_back(DocsumFieldSpec::FieldIdentifier(0, *type.buildFieldPath("a")));
- fields.push_back(DocsumFieldSpec::FieldIdentifier(0, *type.buildFieldPath("c.e")));
+ {
+ FieldPath path;
+ type.buildFieldPath(path, "a");
+ fields.push_back(DocsumFieldSpec::FieldIdentifier(0, path));
+ }
+ {
+ FieldPath path;
+ type.buildFieldPath(path, "c.e");
+ fields.push_back(DocsumFieldSpec::FieldIdentifier(0, path));
+ }
sfw.setInputFields(fields);
TEST_DO(assertSlimeFieldWriter(sfw, value, "{\"a\":\"foo\",\"c\":{\"e\":\"qux\"}}"));
sfw.clear();
@@ -240,10 +248,18 @@ DocsumTest::requireThatSlimeFieldWriterHandlesMap()
{ // select a subset and then all
SlimeFieldWriter sfw;
DocsumFieldSpec::FieldIdentifierVector fields;
- fields.push_back(DocsumFieldSpec::FieldIdentifier(0, *mapType.buildFieldPath("value.b")));
+ {
+ FieldPath path;
+ mapType.buildFieldPath(path, "value.b");
+ fields.push_back(DocsumFieldSpec::FieldIdentifier(0, path));
+ }
sfw.setInputFields(fields);
TEST_DO(assertSlimeFieldWriter(sfw, mapfv, "[{\"key\":\"k1\",\"value\":{\"b\":\"bar\"}}]"));
- fields[0] = DocsumFieldSpec::FieldIdentifier(0, *mapType.buildFieldPath("{k1}.a"));
+ {
+ FieldPath path;
+ mapType.buildFieldPath(path, "{k1}.a");
+ fields[0] = DocsumFieldSpec::FieldIdentifier(0, path);
+ }
sfw.clear();
sfw.setInputFields(fields);
TEST_DO(assertSlimeFieldWriter(sfw, mapfv, "[{\"key\":\"k1\",\"value\":{\"a\":\"foo\"}}]"));
diff --git a/vsm/src/tests/document/document.cpp b/vsm/src/tests/document/document.cpp
index 599b761ea0b..d6e3f507034 100644
--- a/vsm/src/tests/document/document.cpp
+++ b/vsm/src/tests/document/document.cpp
@@ -34,9 +34,11 @@ DocumentTest::testStorageDocument()
doc->setValue(fb, StringFieldValue("bar"));
SharedFieldPathMap fpmap(new FieldPathMapT());
- fpmap->push_back(*dt.buildFieldPath("a"));
- fpmap->push_back(*dt.buildFieldPath("b"));
- fpmap->push_back(FieldPath());
+ fpmap->emplace_back();
+ dt.buildFieldPath(fpmap->back(),"a");
+ fpmap->emplace_back();
+ dt.buildFieldPath(fpmap->back(), "b");
+ fpmap->emplace_back();
ASSERT_TRUE((*fpmap)[0].size() == 1);
ASSERT_TRUE((*fpmap)[1].size() == 1);
ASSERT_TRUE((*fpmap)[2].size() == 0);
diff --git a/vsm/src/vespa/vsm/common/documenttypemapping.cpp b/vsm/src/vespa/vsm/common/documenttypemapping.cpp
index 4c87f9e186f..679f3d968bd 100644
--- a/vsm/src/vespa/vsm/common/documenttypemapping.cpp
+++ b/vsm/src/vespa/vsm/common/documenttypemapping.cpp
@@ -78,14 +78,11 @@ void DocumentTypeMapping::buildFieldMap(
LOG(debug, "Handling %s -> %d", fname.c_str(), it->second);
try {
if ((it->first[0] != '[') && (it->first != "summaryfeatures") && (it->first != "rankfeatures") && (it->first != "ranklog") && (it->first != "sddocname") && (it->first != "documentid")) {
- FieldPath::UP fieldPath = docType.buildFieldPath(fname);
- if (fieldPath.get()) {
- fieldMap[it->second] = *fieldPath;
- validCount++;
- LOG(spam, "Found %s -> %d in document", fname.c_str(), it->second);
- } else {
- LOG(debug, "Failed to find %s -> %d in document", fname.c_str(), it->second);
- }
+ FieldPath fieldPath;
+ docType.buildFieldPath(fieldPath, fname);
+ fieldMap[it->second] = std::move(fieldPath);
+ validCount++;
+ LOG(spam, "Found %s -> %d in document", fname.c_str(), it->second);
}
} catch (const std::exception & e) {
LOG(debug, "Could not get field info for '%s' in documenttype '%s' (id = '%s') : %s",