diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-02-04 16:21:55 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-02-04 16:23:37 +0000 |
commit | 9c29964bc758cf5b46699238fa05f10a780b499e (patch) | |
tree | 118072593f26031d6baabb7d7646fd1a45d7f239 /searchsummary | |
parent | 6f4009bdee8a35ebaef967ce60e8623a5cc7fefd (diff) |
special case for PositionDataType
Diffstat (limited to 'searchsummary')
-rw-r--r-- | searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp b/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp index 31b953362dd..597cfe8eb40 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp @@ -2,12 +2,14 @@ #include "summaryfieldconverter.h" #include "linguisticsannotation.h" +#include "resultconfig.h" #include "searchdatatype.h" #include <vespa/document/annotation/alternatespanlist.h> #include <vespa/document/annotation/annotation.h> #include <vespa/document/annotation/spantree.h> #include <vespa/document/annotation/spantreevisitor.h> #include <vespa/document/datatype/documenttype.h> +#include <vespa/document/datatype/positiondatatype.h> #include <vespa/document/fieldvalue/arrayfieldvalue.h> #include <vespa/document/fieldvalue/boolfieldvalue.h> #include <vespa/document/fieldvalue/bytefieldvalue.h> @@ -472,6 +474,18 @@ private: } void visit(const StructFieldValue &value) override { + if (value.getDataType() == &document::PositionDataType::getInstance() + && ResultConfig::wantedV8geoPositions()) + { + auto xv = value.getValue("x"); + auto yv = value.getValue("y"); + if (xv && yv) { + Cursor &c = _inserter.insertObject(); + c.setDouble("lat", double(yv->getAsInt()) / 1.0e6); + c.setDouble("lng", double(xv->getAsInt()) / 1.0e6); + return; + } + } if (*value.getDataType() == *SearchDataType::URI) { FieldValue::UP uriAllValue = value.getValue("all"); if (uriAllValue && |