diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-07-26 19:36:35 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-07-31 17:04:19 +0200 |
commit | 56abd0f8faac631ec3257b4d2eaf4f44757bf8ac (patch) | |
tree | 2b1d7fa05b54930c3390ae9957169e21e789ae8d /searchcore/src | |
parent | 70f3ef6c0523ecd90d327642b96a5bc619df4e3a (diff) |
Handle unknown fields.
Diffstat (limited to 'searchcore/src')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index 740f65ea27b..6d4915d800d 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp @@ -8,6 +8,8 @@ #include <vespa/document/datatype/documenttype.h> #include <vespa/log/log.h> +#include <vespa/document/base/exceptions.h> + LOG_SETUP(".proton.server.attributeadapter"); using namespace document; @@ -43,7 +45,10 @@ AttributeWriter::WriteContext::buildFieldPaths(const DocumentType &docType) for (const auto &attrp : _attributes) { const vespalib::string &name = attrp->getName(); FieldPath fp; - docType.buildFieldPath(fp, name); + try { + docType.buildFieldPath(fp, name); + } catch (document::FieldNotFoundException & e) { } + assert(fieldId < _fieldPaths.size()); _fieldPaths[fieldId] = std::move(fp); ++fieldId; @@ -199,7 +204,9 @@ PutTask::PutTask(const AttributeWriter::WriteContext &wc, SerialNum serialNum, c _fieldValues.reserve(fieldPaths.size()); for (const auto &fieldPath : fieldPaths) { FieldValue::UP fv; - fv = doc.getNestedFieldValue(fieldPath.getFullRange()); + if (!fieldPath.empty()) { + fv = doc.getNestedFieldValue(fieldPath.getFullRange()); + } _fieldValues.emplace_back(std::move(fv)); } } |