summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-02-04 16:21:55 +0000
committerArne H Juul <arnej@yahooinc.com>2022-02-04 16:23:37 +0000
commit9c29964bc758cf5b46699238fa05f10a780b499e (patch)
tree118072593f26031d6baabb7d7646fd1a45d7f239
parent6f4009bdee8a35ebaef967ce60e8623a5cc7fefd (diff)
special case for PositionDataType
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp14
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 &&