summaryrefslogtreecommitdiffstats
path: root/searchsummary
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-01-27 16:28:34 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-01-27 16:28:34 +0000
commitd554be2c348fe0624b1d821405883d60526ab068 (patch)
treee43f8a7e602433862171bb4bfb6766f7c0f362a0 /searchsummary
parent39a54ddf952cdaf898f2a2b6011a415610d08ffd (diff)
Use an interface that guarantees lifetime, and hence allows for optimizations.
Diffstat (limited to 'searchsummary')
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/general_result.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/general_result.cpp b/searchsummary/src/vespa/searchsummary/docsummary/general_result.cpp
index a6a5263f5ac..030cf7e82c1 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/general_result.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/general_result.cpp
@@ -3,6 +3,7 @@
#include "general_result.h"
#include "resultconfig.h"
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/datatype.h>
#include <zlib.h>
#include <cassert>
@@ -96,7 +97,13 @@ std::unique_ptr<document::FieldValue>
GeneralResult::get_field_value(const vespalib::string& field_name) const
{
if (_document != nullptr) {
- return _document->getValue(field_name);
+ const document::Field & field = _document->getField(field_name);
+ auto value(field.getDataType().createFieldValue());
+ if (value) {
+ if (_document->getValue(field, *value)) {
+ return value;
+ }
+ }
}
return std::unique_ptr<document::FieldValue>();
}