summaryrefslogtreecommitdiffstats
path: root/searchsummary
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-09-15 14:22:07 +0200
committerTor Egge <Tor.Egge@online.no>2022-09-15 14:22:07 +0200
commit80caf1f7df6571dbd7d05fed8b48493e0056cba2 (patch)
tree2b88800208936c3d1318699367266ef8ab927128 /searchsummary
parent754926e273acdb87bc43449ffb11f06a40a65ed3 (diff)
Simplify setting of wanted v8 geo positions.
Diffstat (limited to 'searchsummary')
-rw-r--r--searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp21
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp6
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h3
3 files changed, 12 insertions, 18 deletions
diff --git a/searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp b/searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp
index 49451d21bc5..cf4006c5e67 100644
--- a/searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp
+++ b/searchsummary/src/tests/docsummary/slime_filler/slime_filler_test.cpp
@@ -148,21 +148,6 @@ public:
};
-void
-set_v8_geo_positions(bool value)
-{
- SummaryConfigBuilder empty;
- empty.usev8geopositions = value;
- empty.defaultsummaryid = 0;
- empty.classes.emplace_back();
- auto& default_summary_class = empty.classes.back();
- default_summary_class.id = 0;
- default_summary_class.name = "default";
- ResultConfig config;
- MockDocsumFieldWriterFactory mock_factory;
- config.ReadConfig(empty, "dummy", mock_factory);
-}
-
DocumenttypesConfig
get_document_types_config()
{
@@ -455,16 +440,16 @@ TEST_F(SlimeFillerTest, insert_raw)
TEST_F(SlimeFillerTest, insert_position)
{
- set_v8_geo_positions(true);
+ ResultConfig::set_wanted_v8_geo_positions(true);
{
SCOPED_TRACE("normal position");
StructFieldValue position(get_data_type("position"));
position.setValue("x", IntFieldValue(500000));
position.setValue("y", IntFieldValue(750000));
expect_insert(R"({"lat":0.75,"lng":0.5})", position);
- set_v8_geo_positions(false);
+ ResultConfig::set_wanted_v8_geo_positions(false);
expect_insert(R"({"y":750000,"x":500000})", position);
- set_v8_geo_positions(true);
+ ResultConfig::set_wanted_v8_geo_positions(true);
}
{
SCOPED_TRACE("partial position");
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp
index 0a4f607b962..77714ddd98f 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp
@@ -90,6 +90,12 @@ bool ResultConfig::wantedV8geoPositions() {
return global_useV8geoPositions;
}
+void
+ResultConfig::set_wanted_v8_geo_positions(bool value)
+{
+ global_useV8geoPositions = value;
+}
+
bool
ResultConfig::ReadConfig(const SummaryConfig &cfg, const char *configId, IDocsumFieldWriterFactory& docsum_field_writer_factory)
{
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h
index 810888fb637..0e9f720cbad 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h
+++ b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h
@@ -94,6 +94,9 @@ public:
// whether last config seen wanted useV8geoPositions = true
static bool wantedV8geoPositions();
+ // This function should only be called by unit tests.
+ static void set_wanted_v8_geo_positions(bool value);
+
/**
* @return the name of the given result field type.
* @param resType enum value of a result field type.